-
Book Overview & Buying
-
Table Of Contents
Ember.js Cookbook
By :
When loading your application, the router looks at the URL and matches it to the route. We'll go over some basics on how this works.
The route map is used to define the URL mappings. Let's take a look at adding a new route using this.route.
In a new application, open the router.js file in the app folder. To begin, we'll create a new route called about:
// app/router.js
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('about');
});
export default Router;Router.map in the preceding code handles the routing of the program. The this.route creates the about route. By default, the name of the route will be the same as the path to it. For example, the about route path would be located at /about. We can specifically set the path using path.
Instead of having all requests go to /about, let's change the path so that they go to...
Change the font size
Change margin width
Change background colour