我越來越的ReferenceError:成功沒有定義 - Angularjs
authControllers.js:
:做從控制器一個寧靜的電話時,我的Node.js的後端如下「的ReferenceError成功沒有定義」authControllers.controller('authCtrl', ['$scope', '$location', '$window', 'UserService', 'AuthenticationService',
function authCtrl($scope, $location, $window, UserService, AuthenticationService) {
$scope.me = function() {
UserService.me(function(res) {
$scope.myDetails = res;
}, function() {
console.log('Failed to fetch details');
$rootScope.error = 'Failed to fetch details';
})
};
}]);
HTML:
<div class="row" data-ng-controller="authCtrl" data-ng-init="me()">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
<strong>Your Details</strong>
</div>
<div class="panel-body">
<p>{{myDetails.data.username}}</p>
<p>{{myDetails.data.email}}</p>
</div>
</div>
</div>
</div>
authServices.js:
authServices.factory('UserService',['$http', function($http) {
return {
me:function() {
return $http.get(options.api.base_url + '/me').success(success).error(error)
}
}
}]);
正在收到一個成功的nodeJs調用,它也返回數據,但無法在前端得到它。請幫忙 !
你應該有我搜索過,但我沒有得到任何特定結果這個搜索在谷歌,而不是SOF –
。 –
@NarendraSolanki在網上有幾十篇關於這方面的文章。也是一步一步解釋它的youtube視頻。 – lin