Skip to content

Instantly share code, notes, and snippets.

@workmanw
Last active April 28, 2017 01:12
Show Gist options
  • Save workmanw/c7d9e1a7a61a07eb14e6931ce0ae9c8a to your computer and use it in GitHub Desktop.
Save workmanw/c7d9e1a7a61a07eb14e6931ce0ae9c8a to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
retry() {
this.get('retryTransition').retry();
}
}
});
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');
this.route('author');
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
transitionAndRetry() {
let t = this.transitionTo('author');
t.abort();
this.transitionTo('blog');
let appController = this.controllerFor('application');
appController.set('retryTransition', t);
}
}
});
<h1>Welcome to {{appName}}</h1>
{{#link-to 'index'}}Home{{/link-to}}
{{#link-to 'blog'}}Blog{{/link-to}}
{{#link-to 'author'}}Author{{/link-to}}
<br>
<button {{action "transitionAndRetry"}}>Transition And Abort</button>
<button {{action "retry"}}>Retry Transition</button>
<br>
<br>
{{outlet}}
<br>
<br>
{
"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": "beta",
"ember-testing": "beta"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment