Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GavinJoyce/0da5e43d515c4f872359 to your computer and use it in GitHub Desktop.
Save GavinJoyce/0da5e43d515c4f872359 to your computer and use it in GitHub Desktop.
intermediateTransitionTo()
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
// We simulate a model that would take 5 seconds to be loaded
return new Promise((resolve, reject) => {
Ember.run.later(() => {resolve();}, 2000);
});
},
actions: {
loading(transition, originRoute) {
// This doesn't raise an exception
this.intermediateTransitionTo('dynamic', {});
// This does
//this.intermediateTransitionTo('non_dynamic', {});
// This doesn't
//this.intermediateTransitionTo('non_dynamic');
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('dynamic', { path: '/a/:id' });
this.route('non_dynamic');
});
export default Router;
{
"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