저는 angularjs에 다소 익숙하며 서비스에 약간의 어려움을 겪고 있습니다. 그래서 나는 각도 응용 프로그램과 서비스로 할 일을하고 있었고 작동시키지 못했습니다. 이 내 컨트롤러앵귤러 JS 서비스가 작동하지 않습니다
.controller("myController", ['$scope','toDoService', function($scope,toDoService){
var lists = toDoService.getLists();
$scope.lists = lists;
$scope.add = function(){
// WHAT TO PUT HERE????
}
이며,이
.service('toDoService', function(){
this.getLists =function(){
var list = [
{"name" : "abebe" ,"done":false, id: Date.now()}
];
return list;
}
this.add = function(){
$scope.lists.push({'name':$scope.nameSpace,'done':false, id: Date.now()});
$scope.nameSpace = '';
return this;
}
});
당신은이 같은 서비스 내에서 $ 범위를 사용할 수 없습니다 ADVANCE
당신은 오류가 있습니까? – DMCISSOKHO
nop, 내 콘솔에 오류가 없습니다. – Harun