Skip to content

Instantly share code, notes, and snippets.

@nathanhammond
Last active October 7, 2016 07:20
Show Gist options
  • Save nathanhammond/282a7a5d83d05e2ed06d5ee7cc624c83 to your computer and use it in GitHub Desktop.
Save nathanhammond/282a7a5d83d05e2ed06d5ee7cc624c83 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('login', {path: '/'});
this.route('dashboard', {path: '/dashboard/:foo'});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model() {
throw new Error();
}
});
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
login: function() {
this.transitionTo('dashboard');
}
}
});
<h1>Application</h1>
<hr />
{{outlet}}
<h2>Dashboard</h2>
{{#link-to 'login'}}logout{{/link-to}}
<h2>Login</h2>
<input type="submit" value="login" {{action "login"}}/>
{
"version": "0.10.5",
"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.8.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment