angularjs - Angular JS RouteProvider does not call -


i'm working on e-commerce webapp learn angular. have menu on home page (common , visible on pages), provides available products e.g. books, clothes etc.

on menu have list items follows:

<li><a href="#/searchproducts" ng-click="searchproduct('computers')">computers</a></li> <li><a href="#/searchproducts" ng-click="searchproduct('academics professional')">academics & professional</a></li>

searchproduct function in first controller sets selected product in scope , sets location.path.

$scope.searchproduct =function(producttbsearched){                   $scope.tbfproduct=producttbsearched;             $location.path("/searchproducts");         } 

i have route provider in first controller refers html , 2nd controller.

$routeprovider.when("/searchproducts", {                     templateurl: "./views/homesearchproducts.html" ,     controller: "productsearchctrl" }); 

in second controller, call rest ws search db , build response json. issue when click on first item on menu @ home page, search results , can see url gets changed ".......index2.html#/searchproducts"

now @ page when try choose menu item, routeprovider not call "productsearchctrl" again , no ajax call executed newly selected item. on this?

i think trying reload route. can update code below in order reload route.

$scope.searchproduct =function(producttbsearched){           $scope.tbfproduct=producttbsearched;     if($location.path() === "/searchproducts") {         $route.reload();     } else {         $location.path("/searchproducts");     } } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -