值未显示在html视图中

时间:2019-01-06 14:37:24

标签: angularjs ionic-framework ionic-v1

我的ionic v1代码有问题。在移动设备中,当我检查html中未显示的名称值时。这是我的代码,请仔细检查。

$rootScope.loginCheck = function(){


           if(localStorage.token !== undefined){

            $http.post(API.URL+"/check", {'token' : localStorage.token})
            .then(function(res){

                if(res.data.response == 1){
                    $rootScope.pushInitialized();

                    $rootScope.loginUser = res.data.user;

                    $rootScope.city = res.data.city;

                    $rootScope.isLogin = true;
                    localStorage.isLogin = true;
                    $rootScope.count = res.data.count; 


                }else{

                    localStorage.removeItem("token");
                    localStorage.removeItem("isLogin");
                    localStorage.removeItem("loginDetails");
                    $rootScope.isLogin = false;
                    ionicToast.show("Token has been expired, try login again", "bottom", false, 10000);
                    $rootScope.redirectToWithoutBack("landing.landing");
                }

            }, function(err){

            })
          }else{


            localStorage.removeItem("token");
            localStorage.removeItem("isLogin");
            localStorage.removeItem("loginDetails");
            $rootScope.isLogin = false;
            ionicToast.show("Token has been expired, try login again", "bottom", false, 10000);
            $rootScope.redirectToWithoutBack("landing.landing");

          } 

    };

这是在特定页面的控制器中调用的函数。我在此变量"$rootScope.loginUser"中得到了值,并显示在下面给出的html视图中。

<p style="color: #ffffff; text-transform: uppercase;">{{loginUser.name}}</p>

可以完美地在笔记本电脑中工作,但不能在移动apk中工作。

0 个答案:

没有答案
相关问题