angularjs - $routeProvider not loading template when url has a parameter -


i have use angular's $routeprovider load templates using code similar this

$routeprovider.when('/store', {     templateurl: 'views/store.html',     controller: 'storecontroller' }); 

however, when use code below nothing happens. is, template not loaded. think must because have parameter in url, i'm not sure.

$routeprovider.when('/item/:item_id/info', {     templateurl: 'views/item.html',     controller: 'itemsctrl' }); 

how can work?

update: clear, links this: ng-click="setroute('/item/1/info')" "1" parameter.

update2:

$scope.setroute = function(route){ $location.path(route); };  

update3:

the parameter :item_id being loaded via $http. when inspect source code page see parameter (e.g., "123"), reason not bound setroute function. if hard code parameter works, don't want hard code it. how can bind url parameter works?

you need make partials absolute in:

templateurl: '/views/item.html', 

when parameter added looks @ depth of directory , wants load /item/views/item.html


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -