안녕하세요 저는 각도 j에 익숙하지 않습니다. 여기서는 서버에서 컨트롤러로 json을 가져 와서 데이터를 처리 할 수 있지만 여기서 발생하는 첫 번째 경고는 -11입니다. 그래서 나는 그것을 시도하지만 여전히 내가 미리앵귤러 js에서의 비동기 호출
sampleApp.controller('firstpage', function ($scope, $q, $http, $templateCache, onlinedata, offlinedata) {
$scope.message = 'This is Add new order screen';
var defer = $q.defer();
defer.promise.then(function() {
$scope.method = 'POST';
$scope.url = 'http://ncrts.com/ncrtssales_compadmin/webservices/user_login';
$scope.fetch = function() {
$scope.code = null;
$scope.response = null;
alert($scope.response + 11) //alert11
$http({
method: $scope.method,
url: $scope.url,
cache: $templateCache
}).
success(function (data, status) {
$scope.status = status;
$scope.message = data;
alert($scope.message + 1) //alert1
}).
error(function (data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
};
$scope.fetch();
})
.then(function() {
alert($scope.message + 2); //alert 2
})
defer.resolve();
//alert($scope.remember)
});
여기서 alert-3은 무엇입니까? –
죄송합니다 경고 1, 편집 됨 – kavinhuh