Reputation:
I'm using the code below to hide the navbar and sidebar in my application template in the routes: index.index
, login.index
, errors.404
, errors.505
and errors.feature:
hideNavbarAndSidebar: computed.equal('currentRouteName',
'index.index',
'login.index',
'errors.404',
'errors.505',
'errors.feature'
),
The problem is: Doesn't work. Will only work in the first route, the index.index
How could i improve this code to make what i need??
Thanks.
Upvotes: 1
Views: 41
Reputation: 35501
Ember.computed.equal only takes a single dependent key and a single value:
function equal(dependentKey, value)
If you want to compare to multiple values, you have to write your own computed property that depends on the currentRouteName
and compares it to all of your values.
Here's one way how to do it in the latest Ember:
hideNavbarAndSidebar: Ember.computed('currentRouteName', function() {
let route = this.get('currentRouteName');
let routes = ['index.index', 'login.index', 'errors.404', 'errors.505','errors.feature'];
return routes.indexOf(route) !== -1;
})
Upvotes: 1