-
Book Overview & Buying
-
Table Of Contents
Spring Essentials
By :
An Ember application transitions its state between a set of routes; each can render a template that displays the current state and a controller to support its state-based data. Routes are registered inside the router configuration, typically inside router.js, in the case of an Ember CLI project structure. Routes are defined inside their own JS files.
Routes can be generated and autoconfigured from the command line as follows:
ember generate route user --pod
This command generates route.js and template.hbs under app/<pod-directory>/user/. Upon generation, both artifacts will have a basic structure and you need to flesh them out according to your specific requirements. A typical route will have a model hook, which prepares its data. See the structure of a typical but minimal route given in the following code:
import Ember from 'ember';
export default Ember.Route.extend({
model: function(args) {
return this.store.findAll('task');
}
});In the preceding example,...
Change the font size
Change margin width
Change background colour