javascript - ember route event didTransition timing -


i want open modal in route after transitioning it. guess use "didtransition" event. in called method (a util) refer ember.view object.

my route actions:

actions: {   openmodal: modal.open,   closemodal: modal.close,   togglemodal: modal.toggle,    didtransition: function() {     this.send('openmodal', 'choose');   } } 

the problem using:

didtransition: function() {     this.send('openmodal', 'choose'); } 

doesn't work (because view object undefined, see further down in utils), using:

didtransition: function() {     settimeout(function() {         self.send('openmodal', 'choose');     }, 0); } 

does work.

why not work standard call? guess it's problem synchronicity.

the utils looks following:

import ember 'ember';  export default {   open: function(id) {     console.log('utils open');     var modal = ember.view.views[id];      // test output debugging     console.log(modal);      modal.send('open');   },   close: function(id) {     var modal = ember.view.views[id];     modal.send('close');   },   toggle: function(id) {     var modal = ember.view.views[id];     modal.send('toggle');   } }; 

am missing or there better method doing this? using ember.js 1.12.0.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -