ember.js - Prevent transition out of current route, but not subroutes? -


in circumstances want prevent user transitioning out of active route, @ same time user should able transition between sub-routes of current route. i'm can use willtransition event detect if transition initiated, how detect if transition exit current route or transition between subroutes of current route?

the official ember guide doesn't in case. http://emberjs.com/guides/routing/preventing-and-retrying-transitions/

there may better way, make work inspecting transition object as:

em.route.extend({    actions: {     willtransition: function(transition) {       var name = this.routename;        var istransitionout = transition.state.handlerinfos.every(function(item){         return name !== item.name;       });        if (istransitionout) {         alert('aborting');         transition.abort();       }     }   } }); 

http://emberjs.jsbin.com/nilac/1/edit


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -