Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active August 17, 2016 11:31
Show Gist options
  • Save kumkanillam/4abc9d1cb47746fc5df286044ca9b242 to your computer and use it in GitHub Desktop.
Save kumkanillam/4abc9d1cb47746fc5df286044ca9b242 to your computer and use it in GitHub Desktop.
Demo Route
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions:{
goto(){
console.log('goto');
this.transitionToRoute('index');
}
}
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('index',{path:'/'});
this.route('user');
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
actions:{
login(){
console.log('login');
this.transitionTo('index');
},
logout(){
console.log('logout');
this.transitionTo('application');
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
});
<h1>Application.hbs</h1>
<br>
<button {{action "login"}}> Login </button>
<button {{action "goto"}}> Go To Application</button>
<button {{action "logout"}}> Logout </button>
<br>
{{outlet}}
<br>
<br>
include component specific to user role.
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment