I am showing and hinding a HTML tag by setting variable as true
or false
. It works fine, but when a user clicks on the back button of the browser, the method is not triggered. In my route my init look like :
init(){
this.controllerFor('auth-page').set('naviTab', true );
console.log('init called')
},
It works if the page is refreshed, but not by using the browsers back or forward buttons. How can I fix this?
First and foremost be sure to write: this._super(...arguments), when overriding init (https://www.emberjs.com/api/ember/2.14/classes/Ember.Route/methods/init?anchor=init)
For back and forward events look at activate and deactive events for a route https://www.emberjs.com/api/ember/2.14/classes/Ember.Route/events?anchor=activate