Skip to content

Instantly share code, notes, and snippets.

@rogatty
Last active January 18, 2018 14:49
Show Gist options
  • Save rogatty/3ae976c2be8cd2cc10e405918cf4b204 to your computer and use it in GitHub Desktop.
Save rogatty/3ae976c2be8cd2cc10e405918cf4b204 to your computer and use it in GitHub Desktop.
Error state URL update
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('article', {path: '/article/:name'});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
if (params.name === 'bad') {
throw new Error('Bad article');
} else {
return params.name;
}
}
});
{{#link-to 'article' 'good'}}Link to good article{{/link-to}}<br>
{{#link-to 'article' 'bad'}}Link to bad article{{/link-to}}
<div>
{{outlet}}
</div>
<strong>This is broken article</strong>
This is {{model}} article
{
"version": "0.13.0",
"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.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment