Created
September 21, 2016 20:39
-
-
Save eddie-ruva/506668d2fce7b00f80791bbc9d34e76e to your computer and use it in GitHub Desktop.
Route lifecycle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myProperty: Ember.computed('model.something', function() { | |
console.log('getting computed property myProperty'); | |
return 'myProperty CP'; | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('my-route', { path: '/'}); | |
this.route('another-route'); | |
}); | |
export default Router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
activate() { | |
console.log('activate'); | |
}, | |
deactivate() { | |
console.log('deactivate'); | |
}, | |
beforeModel() { | |
console.log('beforeModel'); | |
}, | |
afterModel() { | |
console.log('afterModel'); | |
}, | |
model() { | |
console.log('model'); | |
return { something: 1 }; | |
}, | |
setupController(controller, model) { | |
this._super(controller, model); | |
console.log('setupController'); | |
}, | |
actions: { | |
didTransition() { | |
console.log('didTransition'); | |
// If you want to see when deactivate will get exectued you can uncomment the next line | |
//this.transitionTo('another-route'); | |
}, | |
willTransition() { | |
console.log('willTransition'); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment