서버에 이미지를 업로드하는 서비스를 하나 작성했으며 컨트롤러에서이 서비스를 사용하고 있지만 서비스에 정의 된 정의되지 않은 기능을 나타내는 서비스를 호출합니다. 오류가 난이 서비스각도로 정의되지 않은 서비스 표시
app.controller('settingsCtrl', ['$scope','apiCall','$filter', function($scope,apiCall,$filter,fileUpload){
$scope.saveStudioBranch = function(){
studio();
admin();
branch();
}
function studio(){
var studio_json = {"session_id":session_id,"u":[{"col":"studio","val":$scope.studioDetails.studio},{"col":"type","val":$scope.studioDetails.type}],"filter":[["id","=","1"]],"table":"studio"};
apiCall.callEndpoint(studio_json,"settingRoute.php","update",json_header).then(function(response){
if(response.data.error == 0){
if($scope.inst_logo != undefined){
var uploadUrl = "https://papa.fit/routes/registrationRoute.php?action=instLogo";
-->> fileUpload.uploadFileToUrl($scope.inst_logo,session.client_id,uploadUrl);
}
}
else
show_snack(response.data.message);
});
}
});
를 호출하고
app.service('fileUpload', ['$http', function ($http) {
this.uploadFileToUrl = function(file,clientid, uploadUrl){
var fd = new FormData();
fd.append('file', file);
fd.append('id', clientid);
$http.post(uploadUrl, fd, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
})
.success(function(response){
console.log(response)
})
.error(function(){
});
}
}]);
여기 내 코드이 "정의의 속성을 읽을 수 없습니다 'uploadFileToUrl'"같은 여기
이입니다
서비스를 요청할 때 화살표를 추가했습니다.
코드를 어디에 보여 주시겠습니까? – Satpal
오우 죄송합니다. 위의 코드를 편집하고 다시 점검하십시오. –