Reputation: 65
I'm having a problem I can't seem to understand why it is happening:
I have an angular app where one of the routes is defined in the route provider as
.when('/pageA/:item1', {templateUrl:xxx, reloadOnSearch:false})
I have a service function which in turn is using the following code:
var targetUrl = '/pageA/'+item1;
$location.path(targetUrl).search('item2',item2Val);
The problem is that if the user is at a page with a location different than pageA, the url is correct and I Can see both values, item1 and item2. However, if the user is already at pageA and there iis only a change in item1 and item2, the resulting url does not include the search object item2.
Can anyone explain this ?
Thanks.
Upvotes: 0
Views: 309
Reputation: 7326
if you want to catch the change in url, even in the same page, set reloadOnSearch
to true
Upvotes: 1