Last active
April 25, 2017 17:38
-
-
Save nathanhammond/0047f158c32dbb27a00cfaa42dac0f4e to your computer and use it in GitHub Desktop.
Route Transition Error
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: config.locationType, | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('standalone'); | |
this.route('parent', function() { | |
this.route('child'); | |
}); | |
}); | |
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'; | |
import somethingAsync from '../../utils/something-async'; | |
export default Ember.Route.extend({ | |
model() { | |
// WORKS: Only transition error: | |
// return Ember.RSVP.Promise.reject(); | |
// DOESN'T WORK 2.0+: Throws additional error. | |
// Works in 1.13. | |
// Appears to have autorun in scope, is the default error handler. | |
return somethingAsync('child', 'reject'); | |
} | |
}); |
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 somethingAsync from '../utils/something-async'; | |
export default Ember.Route.extend({ | |
model() { | |
return somethingAsync('parent', 'resolve'); | |
} | |
}); |
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 somethingAsync from '../utils/something-async'; | |
export default Ember.Route.extend({ | |
model() { | |
// DOESN'T WORK: Same story as parent.child. | |
return somethingAsync('standalone', 'reject'); | |
} | |
}); |
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.12.1", | |
"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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
} | |
} |
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 function somethingAsync(label, resolution) { | |
return new Ember.RSVP.Promise(function(resolve, reject) { | |
console.log(label, 'invoked'); | |
setTimeout(() => { | |
console.log(label, resolution); | |
if (resolution === 'resolve') { resolve('success'); } | |
if (resolution === 'reject') { reject('error'); } | |
}, 2000); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment