Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/loveky/angular-smart-timeago

An angular wrapper of jquery plugin smart-time-ago https://github.com/pragmaticly/smart-time-ago
https://github.com/loveky/angular-smart-timeago

Last synced: 12 days ago
JSON representation

An angular wrapper of jquery plugin smart-time-ago https://github.com/pragmaticly/smart-time-ago

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/loveky/angular-smart-timeago.svg?branch=master)](https://travis-ci.org/loveky/angular-smart-timeago)

### Installation
You can choose your preferred method of installation:
- Through bower `bower install angular-smart-timeago --save`
- Download from GitHub [angular-smart-timeago.js](https://raw.githubusercontent.com/loveky/angular-smart-timeago/master/src/angular-smart-timeago.js)

### Usage
Include both timeago.js and angular-smart-timeago.js in your application.

```html

```

Add the module `ngSmartTimeago` as a dependency to your app module:

```js
var myapp = angular.module('myapp', ['ngSmartTimeago']);
```

### Directive
You can use `timeago` directive to display a user friendly time. By default, `smart-time-ago` will check the value of `datatime` property for the ISO8601 timesting:
```html

```

### Filter
If you just want to tranform the time string to a user friendly format but do not need to periodly refresh, you can use the `timeago` filter to perform a one-time convert:
```html

{{"2014-05-29T12:01:50+0800" | timeago}}


```

### Configuration
If you want to change the default property name which specifies the ISO8601 time string for all directive instance. You can do it with:

```js
angular.module('myapp').constant('ngSmartTimeagoConfig', {
attr: 'datastring'
});
```
Then you could write like this:
```html

```