2
TypeError:无法读取未定义的属性“ then”
loginService.islogged() 上面的函数返回类似“ failed”的字符串。但是,当我尝试运行然后对其执行功能时,它将返回以下错误 TypeError: Cannot read property 'then' of undefined 并且光标指示在connected之前和之后.then。 以下是全部功能: var connected=loginService.islogged(); alert(connected); connected.then(function(msg){ alert("connected value is "+connected); alert("msg.data value is "+msg.data); if(!msg.data.account_session || loginService.islogged()=="failed") $location.path('/login'); }); 更新 这是islogged()功能 islogged:function(){ var cUid=sessionService.get('uid'); alert("in loginServce, cuid is "+cUid); var $checkSessionServer=$http.post('data/check_session.php?cUid='+cUid); $checkSessionServer.then(function(){ alert("session check returned!"); console.log("checkSessionServer is "+$checkSessionServer); return $checkSessionServer; …