Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/loveky/angular-smart-timeago
- Owner: loveky
- License: mit
- Created: 2014-05-28T03:31:46.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-04T01:55:10.000Z (over 10 years ago)
- Last Synced: 2024-10-09T02:33:20.005Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 277 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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```