Durandal: Determining if a view is currently active (possibly using Router)? -


my shell has buttons should displayed if user viewing viewmodel. how can determine whether or not view "active" shell?

assuming routes defined in shell.js activate using viewattached allow access router object.

return {     router: router,     viewattached: function () {         console.log('activeroute', router.activeroute());     },     activate: function () {         router.map([... 

update based on comment

in durandal 2.x activeroute() isn't defined longer. use router.activeinstruction() instead.

update 2 based on comment

in durandal 2.x viewattached attached.

note: need access current route's configuration in order @ custom properties or other information, can access raw data via router.activeinstruction() instruction contains fragment, querystring, params, , queryparams. contains config property same instance original route config.

http://durandaljs.com/documentation/conversion-guide/


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -