angularJS重定向到登录页面而不是指定的URL

时间:2016-04-27 06:16:49

标签: angularjs

我有一个应用程序,可以搜索患者并找到重定向到处方页面的应用程序。如果没有找到任何内容,应用程序就可以了,并返回一条未找到的消息,但是当我们找到病人时,它会重定向到登录页面而不是处方页面。

这是功能代码

$http({

            method: 'POST',
            url: 'http://104.155.102.226:8033/patientsearch/',
            data: {
                 'national_id': $scope.national_id,
                 'insurance_company':$scope.insurance_company,
                 'member_number': $scope.member_number,
                 'dob':$scope.dob,
                 'phone': $scope.phone_number
            },
            headers: {
                'accept':'application/json',
                'Content-Type':'application/json'
            }

        }).success(function(data){
            if(Object.keys(data).length == 0){

              $scope.message = "No Patient with those credentials found in our databases";

            } else {
              $timeout(function(){ 
                 sessionStorage.setItem('memberData', JSON.stringify(data));
                 $location.path('/doctors/prescribe');
              },1);
              // sessionStorage.setItem('memberData', JSON.stringify(data));
              // $location.path('/doctors/prescribe');


            }


            //console.log(memberData);

        }).error(function(error){
          console.log(error)
        });

1 个答案:

答案 0 :(得分:0)

问题是没有为' / doctors / prescribe'

设置网址
  • 检查' /医生/处方'网址工作正常,