so i am kinda new to angularjs and is facing a little difficulty with services. so i was working on an angularjs TO DO app and with services and can not get it working. This is my controller
.controller("myController", ['$scope','toDoService', function($scope,toDoService){
var lists = toDoService.getLists();
$scope.lists = lists;
$scope.add = function(){
// WHAT TO PUT 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 IN ADVANCE