콘솔에 오류가 발생했습니다. 난 각도로 이온 (V1)을 이용하고 있고 제 후단은 PHP,이 문제는 주입하기 위해 컨트롤러
내 controllers.js 내 app.js
var app = angular.module('starter', ['ionic','starter','starterService'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
이다
Error: [$injector:unpr] Unknown provider: starterServiceProvider <- starterService
http://errors.angularjs.org/1.2.12/$injector/unpr?p0=starterServiceProvider%20%3C-%20starterService
at ionic.bundle.js:7536
at ionic.bundle.js:11004
at Object.getService [as get] (ionic.bundle.js:11131)
at ionic.bundle.js:11009
at getService (ionic.bundle.js:11131)
at invoke (ionic.bundle.js:11158)
at Object.instantiate (ionic.bundle.js:11179)
at ionic.bundle.js:14238
at ionic.bundle.js:13647
at forEach (ionic.bundle.js:7768)
MySQL의 인 데이터 서비스 "starterServices"
.controller('ToDoListCtrl',['starterService' , function($scope,$ionicModal,starterService) {
$scope.toDoListItems = [{
task: 'Scuba Diving',
status: 'not done'
}, {
task: 'Climb Everest',
status: 'not done'
}];
$scope.AddItem = function(data){
var addTask = starterService.addtask();
addTask.then(function(data){
$scope.task = data.task;
$scope.status = data.status;
});
};
/*$scope.toDoListItems.push({task:data.newItem,status:'not done'});
data.newItem = ' ';
$scope.closeModalAdd();*/
$scope.DeleteItem = function(data){
var ans = confirm('Are you sure to delete it?');
if(ans){
var deleteTask = starterService.delTask(task);
alert('Sucessfully deleted task ',+ data.task);
}
/*
$scope.toDoListItems.pop({task: data.newItem});
data.newItem = ' ';
$scope.closeModalDelete();
*/
alert('Sucessfully deleted task ');
};
$ionicModal.fromTemplateUrl('modal.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
$ionicModal.fromTemplateUrl('dmodal.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(dmodal) {
$scope.dmodal = dmodal;
});
$scope.openModalAdd = function() {
$scope.modal.show();
};
$scope.closeModalAdd = function() {
$scope.modal.hide();
};
$scope.openModalDelete = function() {
$scope.dmodal.show();
};
$scope.closeModalDelete = function() {
$scope.dmodal.hide();
};
//Cleanup the modal when we're done with it!
$scope.$on('$destroy', function() {
$scope.modal.remove();
$scope.dmodal.remove();
});
}]);
이 내 service.js입니다 HTML 페이지에서오고 및 호출
,691,363 (210)app.service('starterService', function($http){
var serviceUrl = "http://localhost/2404/CRUD Ionic/www/php/";
this.addtask = function(data){
var response = $http({
method : "POST",
url : serviceUrl + "createTask.php",
params : data
});
return response;
};
this.delTask = function(task){
var response = $http ({
method : "POST",
usr : serviceUrl + "deleteTask.php",
params : {task}
});
return response;
};
});
'service.js'를'html' 페이지에 포함 시켰습니까? 헤더 에서 –
예는 <스크립트 SRC = "JS/service.js"> <스크립트 SRC = "JS <스크립트 SRC ="JS/app.js "> /controllers.js "> –