Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #268 from jwanglof/master
Browse files Browse the repository at this point in the history
Added a DI example to README
  • Loading branch information
urish committed Sep 23, 2016
2 parents 7798910 + 40b2abd commit d835952
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ myapp.run(function(amMoment) {
});
```


### Use in controller/service/factory
Inject the `moment`-constant into your dependency injection. For example:

```js
angular.module('fooApp')
.controller('FooCtrl', ['$scope', 'moment', function ($scope, moment) {
$scope.exampleDate = moment().hour(8).minute(0).second(0).toDate();
}]);
```

### am-time-ago directive
Use the `am-time-ago` directive to format your relative timestamps. For example:

Expand Down

0 comments on commit d835952

Please sign in to comment.