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
Post a Comment