AngularJS에서 새로 생겼습니다. 공장 기능에서 json 파일을 호출하려고했지만 내 var customers = [];
배열이 업데이트되지 않는다는 것을 보여줍니다. 도와주세요.Angular Factory에서 JSON 파일 호출이 작동하지 않습니다.
아래 코드는 제 코드입니다. 당신은 당신이 "$"HTTP 전에 서명을 넣어해야한다고 생각하지 마십시오
demoApp.factory('simpleFactory', ['$http', function($http){
return {
getCustomer: function(){
return $http.get("json/customers.json").then(
function(response){
var customers = [];
customers = response.data;
},
function(error){
console.log(error);
});
}
}
}]);
위대한 aarosil 당신은 챔피언입니다 !! –