Skip to content

Instantly share code, notes, and snippets.

@bekzod
Created January 5, 2016 20:46
Show Gist options
  • Save bekzod/c98527cf6c5d0e11a4cc to your computer and use it in GitHub Desktop.
Save bekzod/c98527cf6c5d0e11a4cc to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
hideHomeButtonRoutes: ['index', 'login'],
isHomeButtonVisible: Ember.computed('currentRouteName', function(){
return this.get('hideHomeButtonRoutes').indexOf(this.get('currentRouteName')) === -1;
})
});
<h1>Current route {{currentRouteName}}</h1>
{{#if isHomeButtonVisible}}
{{#link-to 'index' tagName='button'}}home button{{/link-to}}
{{/if}}
<br/>
{{#link-to 'other-route' tagName='button'}}other route{{/link-to}}
import Ember from 'ember';
export default Ember.Route.extend({
});
<h1>Current route {{currentRouteName}}</h1>
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('other-route');
});
export default Router;
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment