Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active August 17, 2016 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kumkanillam/f91a385096a2acb1f1e30be94b2b2879 to your computer and use it in GitHub Desktop.
Save kumkanillam/f91a385096a2acb1f1e30be94b2b2879 to your computer and use it in GitHub Desktop.
Authenticated Route- UnAuthenticated Route Differentiation
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
myAuthservice:Ember.inject.service(),
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('users');
this.route('authenticated',{path:'/'},function(){
this.route('settings');
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Service.extend({
isAuthenticated: false, //You can non sensitive and authentication specific information.
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{#if myAuthservice.isAuthenticated}}
<h1> Home page design </h1>
{{outlet}}
{{else}}
<h1> Login Page Design </h1>
{{/if}}
<h1>authenticated settings page</h1>
{
"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