Php $location.path在angularjs中不起作用
$location.path从php成功返回后未重定向。从php页面返回的数据不是空的。php文件返回正确数据没有问题。问题是$location.path不起作用。我参考了许多网站,但我找不到解决方案帮助我Php $location.path在angularjs中不起作用,php,angularjs,Php,Angularjs,$location.path从php成功返回后未重定向。从php页面返回的数据不是空的。php文件返回正确数据没有问题。问题是$location.path不起作用。我参考了许多网站,但我找不到解决方案帮助我 angular.module(MyApp).controller(Part3Controller, function ($scope, LoginService) { $scope.IsLogedIn = false; $sco
angular.module(MyApp).controller(Part3Controller, function ($scope, LoginService) {
$scope.IsLogedIn = false;
$scope.Message = '';
$scope.Submitted = false;
$scope.IsFormValid = false;
$scope.MyLogin = {
USER_ID:'' ;
Password: '';
};
//Check is Form Valid or Not // Here f1 is our form Name
$scope.$watch(f1.$valid, function (newVal) {
$scope.IsFormValid = newVal;
});
$scope.Login = function () {
$scope.Submitted = true;
if ($scope.IsFormValid) {
LoginService.GetUser($scope.MyLogin).then(function (d) {
if (d.data.USER_ID != null) {
$scope.IsLogedIn = true;
$location.Path(/LandingPage/FetchMenu);
}
else {
alert('Invalid Credential!');
}
});
}
};
})
.factory('LoginService, function ($http) {
var fac = {};
fac.GetUser = function (d) {
return $http({
url:/Data/UserLogin,
method: POST,
data: JSON.stringify(d),
headers: {content-type:application/json}
});
};
return fac;
});
您尚未注入$location:
angular.module(MyApp).controller(Part3Controller,
function ($scope, LoginService) {
应该是:
angular.module(MyApp).controller(Part3Controller,
function ($location, $scope, LoginService) {
您尚未注入$location:
angular.module(MyApp).controller(Part3Controller,
function ($scope, LoginService) {
应该是:
angular.module(MyApp).controller(Part3Controller,
function ($location, $scope, LoginService) {
似乎,$location没有被注入任何地方?似乎,$location没有被注入任何地方?