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

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -