February 2016
Beginner to intermediate
308 pages
5h 46m
English
A more advanced feature of the router is dealing with asynchronous logic. The following recipes explain this concept using promises.
In the route, Ember makes heavy use of promises. Promises are objects that represent an eventual value. We can use promises in our model.
$ ember g route application
If prompted to overwrite the template, type Y. This will generate the router file for the default application route.
application.js file in the app/router folder:// app/router/application.js import Ember from 'ember'; export default Ember.Route.extend({ model() { return new Ember.RSVP.Promise(function(resolve) { resolve({message: 'Resolved'}); ...Read now
Unlock full access