Last active
January 14, 2016 16:52
-
-
Save hjumeau/654a73ebda453aeab7c9 to your computer and use it in GitHub Desktop.
Redirecting
This file contains 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({ | |
appName:'Ember Twiddle' | |
}); |
This file contains 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({ | |
redirect(){ | |
//this.transitionTo('posts'); | |
}, | |
beforeModel(){ | |
Ember.Logger.info('index beforModel Hook'); | |
}, | |
model(){ | |
Ember.Logger.info('index model Hook'); | |
return 'Index Model'; | |
}, | |
afterModel(model, transition){ | |
Ember.Logger.info('index afterModel Hook'); | |
} | |
/*replace(){ | |
this.transitionTo('posts'); | |
} | |
*/ | |
}); |
This file contains 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({ | |
beforeModel(){ | |
Ember.Logger.info('post beforeModel Hook'); | |
}, | |
model(params){ | |
Ember.Logger.info('post model Hook'); | |
return this.modelFor('posts')[params.post_id]; | |
}, | |
afterModel(model, transition){ | |
Ember.Logger.info('post afterModel Hook'); | |
} | |
}); |
This file contains 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({ | |
/*redirect(){ | |
this.transitionTo('posts.post', { | |
id:1, | |
content: 'Ember is fast and furious' | |
}); | |
},*/ | |
beforeModel(){ | |
Ember.Logger.info('posts beforeModel Hook'); | |
//this.transitionTo('posts.post', {id: 1, content: 'Ember is fast and furious'}); | |
}, | |
model(){ | |
Ember.Logger.info('posts model Hook'); | |
return [{id: 0, content: 'Ember is awsome'}, | |
{id: 1, content: 'Ember is fast and furious'}]; | |
}, | |
afterModel(model, transition){ | |
Ember.Logger.info('posts afterModel Hook'); | |
} | |
//this.transitionTo('posts.post', model.get('lastObject')); | |
}); |
This file contains 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: config.locationType | |
}); | |
Router.map(function() { | |
this.route('posts', function() { | |
this.route('post', { path: ':post_id' }); | |
}); | |
}); | |
export default Router; |
This file contains 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.5.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment