I have a call to $ http, which is created inside the getRoutes function, which fires when this state changes:
$scope.$on('$stateChangeSuccess', function(event) {
$scope.getRoutes($stateParams);
})
I have another function that changes the state parameter and then calls $ state.go ():
$scope.bindSelectedRoute = function(){
$stateParams.pickup_route= this.d.pickup_route;
$state.go('track.search', $stateParams);
}
My problem is that the http call continues to be executed twice. First with the rule $ stateParams, and then the second call with the empty object passed. I assume this is the main part of angular that I am missing.
Any clues?
Best.
source
share