angular-moment

Angular.JS directives for Moment.JS (timeago alternative)
30 people use it
Author: 892318?v=3 urish

angular-moment

Angular.JS directive for Moment.JS.

Copyright (C) 2013, Uri Shaked uri@urish.org

Build Status

Usage

Include both moment.js and angular-moment.js in your application.

Add the module angularMoment as a dependency to your app module:

You can now start using the am-time-ago directive to format your relative timestamps. For example:

angular-moment will dynamically update the span to indicate how much time passed since the message was created. So, if you controller contains the following code: js $scope.message = { text: 'hello world!', time: new Date() };

The user will initially see "a few seconds ago", and about a minute after the span will automatically update with the text "a minute ago", etc.

License

Released under the terms of MIT License:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

comments powered by Disqus
This page was last updated over 3 years ago.