ember.js - Set Ember Application View Class for Homepage Only -


disclaimer: i'm pretty new ember go easy. :)

i'm attempting have class appear "is-home" on div application view gets rendered if value of app.get('currentpath') set 'index'. code below works setting class, however, only on load. if load page , click link, logic not re-run remove class if navigate away homepage or add if entered on different page navigate homepage. i'm convinced i'm missing simple.

any appreciated!

current code (note: i'm using ember app kit)

// app/views/application.js  export default ember.view.extend({   classnamebindings: ['ishome'],   ishome: function() {     if (app.get('currentpath') == 'index') {       return true;     } else {     return false;     }   }.property() }); 

the functionality of app.get('currentpath') derived answer https://stackoverflow.com/a/18302740/3403881.

you have tell property update when currentpath property changes.

ishome: function() { ... }.property('currentpath') 

however, i'm not 100% sure if find currentpath property on view since technically exists on controller. might have watch controller.currentpath instead.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -