angular routing - AngularJS: Adding new routes dynamically -


as use, $routeprovider in config method, of knowledge $route provider.

so, tried adding new routes $route in controller:

after configuring , bootstrapping application, somewhere in controller, tried this:

app.controller('myctrl',function($scope,$route) {   $route.routes['/newroute'] = { template : 'hey, dynamically added route' }; }); 

but doesn't seem work. why?

any ideas?

you can configure routes via ngapp config function only, can't add routes dynamically in runtime. $route service.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -