Last active
September 26, 2017 23:53
-
-
Save gpincheiraa/abc4bc36d49725ec14271e9763f1e282 to your computer and use it in GitHub Desktop.
todoList.component.js - 5 First Impressions using jest for TDD over AngularJS > 1.5.x — Part I Raw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoListController { | |
constructor(){ | |
this.todosList = [ | |
{ | |
name: "Learn Programming using component based approach", | |
completed: true | |
}, | |
{ | |
name: "Learn Machine Learning", | |
completed: false | |
}, | |
{ | |
name: "Finish Medium article", | |
completed: true | |
}, | |
{ | |
name: "Learn to play Jazz music", | |
completed: false | |
}, | |
{ | |
name: "Build a experimental app using google A.I.", | |
completed: false | |
} | |
]; | |
} | |
addTodo(todo){ | |
this.todosList.push(todo) | |
} | |
toggleCheckTodo(index){ | |
this.todosList[index].completed = !this.todosList[index].completed | |
} | |
deleteTodo(index){ | |
this.todosList.splice(index, 1) | |
} | |
} | |
export const TodoListComponent = { | |
templateUrl: '/components/todoList.component.html', | |
controller: TodoListController | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment