I want see all possible paths in some object. How can i do this?
Example i have:
App.Router = Em.Router.extend({
enableLogging: true,
location: 'hash',
root: Em.Route.extend({
// EVENTS
gotoAbout: Ember.Route.transitionTo('about'),
gotoProjects: Ember.Route.transitionTo('projects'),
gotoTechnology: Ember.Route.transitionTo('technology'),
gotoContact: Ember.Route.transitionTo('contact'),
// STATES
about: Em.Route.extend({
route: '/',
connectOutlets: function (router, context) {
router.get('applicationController').connectOutlet('about');
}
}),
...
})
I want print to console ( something like console.log()
) all possible path in App.Router
. How can i do this? How can i check the "tree" in objects in emberjs?
I'd iterate over childStates
, and make a recursive function.
var walkState = function(state){
console.log(state.get('path'));
state.get('childStates').forEach(function(childState){
walkState(childState);
});
}
App.router.get('childStates').forEach(function(state){
walkState(state);
});