I've been working on redirecting to another page in angular after submitting data to an API, and here's the code I used:
$scope.Proceed = function () {
DataService.InsertPerson($scope.p)
.then(function success(data) {
$scope.p.ID = data.data;
var url = "http://" + $window.location.host + "/#/show/person/";
$window.location.href = url + data.data; //adding ID to url
});
};
The page redirected successfully, but Angular threw an error:
Error: $rootScope:infdig Infinite $digest Loop
I also tried using $location but encountered the same issue.
Thank you for your time!