File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
angular . module ( 'todoListApp' )
4
4
. controller ( 'mainCtrl' , function ( $scope , dataService ) {
5
-
5
+
6
6
dataService . getTodos ( function ( response ) {
7
- var todos = response . data ;
7
+ var todos = response . data . todos ;
8
8
$scope . todos = todos ;
9
9
} ) ;
10
-
10
+
11
11
$scope . addTodo = function ( ) {
12
12
$scope . todos . unshift ( { name : "This is a new todo." ,
13
13
completed : false } ) ;
14
14
} ;
15
-
16
- } )
15
+
16
+ } )
Original file line number Diff line number Diff line change 3
3
angular . module ( 'todoListApp' )
4
4
. service ( 'dataService' , function ( $http ) {
5
5
this . getTodos = function ( cb ) {
6
- $http . get ( '/mock /todos.json ' ) . then ( cb ) ;
6
+ $http . get ( '/api /todos' ) . then ( cb ) ;
7
7
} ;
8
-
8
+
9
9
this . deleteTodo = function ( todo ) {
10
10
console . log ( "I deleted the " + todo . name + " todo!" ) ;
11
11
} ;
12
-
12
+
13
13
this . saveTodos = function ( todos ) {
14
14
console . log ( "I saved " + todos . length + " todos!" ) ;
15
15
} ;
16
-
16
+
17
17
} ) ;
You can’t perform that action at this time.
0 commit comments