lundi 22 mai 2017

ember js, continuously invoke init method in controller when user visit page

i have a controller script in ember and iam using init() method in controller. this is my script

export default Ember.Controller.extend({
.....,
init() {
    this._super(...arguments);
    this.set('idUser', this.commonService.getUser().id);
    Ember.$(document).ready(function () {
      let height = Ember.$(window).height() - 96;
      Ember.$(".feed-activity-list").slimScroll({
        height: height.toString() + "px"
      });
    });
  },
})

the init method is invoke when user first time open the page. but when user open another page and back to this page, the controller doesnt invoke the init() method. how to force the controller run init method when user visit this page. Iam avoid using component because its hard to refactor :(




Aucun commentaire:

Enregistrer un commentaire