Can someone help me figure out how to redirect to another page using Angular Js?
I've searched through various questions here but haven't found a successful answer.
This is the code I'm currently working with:
var app = angular.module('formExample',[]);
app.controller('formCtrl',function($scope,$http){
$scope.insertData=function(){
// if($scope.name =='' && $scope.email == '' && $scope.message = '' && $scope.price =='' && $scope.date == null && $scope.client == ''){return;}
$http.post("/php/login.php", {
"email": $scope.email, "password": $scope.password
}).then(function(response, $location){
alert("Login Successfully");
$scope.email = '';
$scope.password = '';
$location.path('/clients');
},function(error){
alert("Sorry! Data Couldn't be inserted!");
console.error(error);
});
}
});
I keep getting this error message:
TypeError: Cannot read property 'path' of undefined