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

Added a DI example to README #268

Merged
merged 1 commit into from
Sep 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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