Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nypublicradio/ember-previous
ember addon to expose previous router states
https://github.com/nypublicradio/ember-previous
Last synced: 18 days ago
JSON representation
ember addon to expose previous router states
- Host: GitHub
- URL: https://github.com/nypublicradio/ember-previous
- Owner: nypublicradio
- License: mit
- Created: 2017-06-19T03:02:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-19T13:11:14.000Z (over 7 years ago)
- Last Synced: 2024-12-21T09:30:39.723Z (22 days ago)
- Language: JavaScript
- Size: 149 KB
- Stars: 1
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-previous
An addon for exposing some useful states of the ember router.
Add the `PreviousMixin` to your app router:
```javascript
...
import PreviousMixin from 'ember-previous/mixins/previous';const Router = Ember.Router.extend(PreviousMixin, {
...
});```
You'll have access to a `previous` object on all your routes.
```javascript
// routes/foo.js
import Ember from 'ember';export default Ember.Route.extend({
setupController(controller) {
this._super(...arguments);
let {
path, // foo.bar
url, // foo/bar
route // foo.bar
} = this.get('previous');
controller.setProperties({ path, url, route });
}
});
```## Installation
* `git clone ` this repository
* `cd ember-previous`
* `npm install`## Running
* `ember serve`
* Visit your app at [http://localhost:4200](http://localhost:4200).## Running Tests
* `npm test` (Runs `ember try:each` to test your addon against multiple Ember versions)
* `ember test`
* `ember test --server`## Building
* `ember build`
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).