Skip to content

Instantly share code, notes, and snippets.

@MiguelMadero
Last active August 16, 2016 14:40
Show Gist options
  • Save MiguelMadero/a71b45443c4394c2c60a7c7bb7e7f9c4 to your computer and use it in GitHub Desktop.
Save MiguelMadero/a71b45443c4394c2c60a7c7bb7e7f9c4 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init () {
this._super(...arguments);
console.log('app controller init');
Ember.run.scheduleOnce('afterRender', function () {
console.log('app controller init afterRender');
});
}
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('blog');
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
didTransition () {
console.log('app didTransition ');
Ember.run.next(function () {
console.log('app didTransition next');
});
Ember.run.scheduleOnce('afterRender', function () {
console.log('app didTransition afterRender');
});
}
},
beforeModel () {
return Ember.$.get('https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js').then(()=>console.log('app beforeModel'));
}
});
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
didTransition () {
console.log('blog didTransition ');
Ember.run.next(function () {
console.log('blog didTransition next');
});
Ember.run.scheduleOnce('afterRender', function () {
console.log('blog didTransition afterRender');
});
}
},
beforeModel () {
return Ember.$.get('https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js').then(()=>console.log('blog beforeModel'));
}
});
import Ember from 'ember';
export default Ember.Route.extend({
redirect () {
console.log('index redirect');
this.transitionTo('blog');
},
});
{{log 'app template actually rendered'}}
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{log 'blog actually rendered'}}
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment