-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (35 loc) · 863 Bytes
/
script.js
File metadata and controls
39 lines (35 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//We have to define our application first
angular.module("toDoList", [])
/*Controller is like a brain of our app. It contain models and logics required
to operate our to do list.
*/
.controller("toDoListCtrl", ['$scope',
function($scope) {
//A model holding tasks
$scope.taskList = [
{done: true,
task: 'Do nothing'
},
{
done: false,
task: 'Study with liv'
},
{
done: false,
task: 'Add a task with liv'
},
{
done: false,
task: 'Ask liv to add music'
}
];
//Function for adding task to the task list
$scope.addTask = function(task) {
//I'm pushing a new task to the task list
$scope.taskList.push({
done: false,
task: task
});
};
}
]);