February 2016
Beginner to intermediate
308 pages
5h 46m
English
Application initializers can be used to configure your application as it boots. It's the primary place to set up dependency injections in your application.
In this example, we'll examine when an application initializer is run.
initializer:
$ ember g initializer application
This will create a new application initializer. This will be run as soon as the application boots.
// app/initializers/application.js
export function initialize( application ) {
alert('loading application');
}
export default {
name: 'application',
initialize
};This will load an alert box as soon as the application loads.
ember server and you should see an alert ...Read now
Unlock full access