Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php $location.path在angularjs中不起作用_Php_Angularjs - Fatal编程技术网

Php $location.path在angularjs中不起作用

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

$location.path从php成功返回后未重定向。从php页面返回的数据不是空的。php文件返回正确数据没有问题。问题是$location.path不起作用。我参考了许多网站,但我找不到解决方案帮助我

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没有被注入任何地方?