Hey everyone, I'm relatively new to AngularJS and running into some issues with services. I've been working on a TO DO app in AngularJS using services but I just can't seem to get it to work correctly. Here is my controller:
.controller("myController", ['$scope','toDoService', function($scope,toDoService){
var lists = toDoService.getLists();
$scope.lists = lists;
$scope.add = function(){
// Any suggestions on what should be added here?
}
And this is my service:
.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;
}
});
Thank you all in advance!