我的js代码是:
var Myapp =angular.module("Myapp",[]);
Myapp.service("Myservice",function($http,$scope){
this.userDate=function(){
return $http({
method:'GET',
url:'js/phone.json'
})
Myapp.controller("Myctrl",function($scope,Myservice){
console.log(Myservice.userDate().phone);
});
我的json文件是:
{
"phone": "1",
"verification": "1"
}
返回的结果是undefine 不知道为什么,我这里哪里有错吗,求大神解答
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
浏览器控制器里看下请求返回的数据是什么