Skip to content

Instantly share code, notes, and snippets.

@gpincheiraa
Last active September 26, 2017 23:53
Show Gist options
  • Save gpincheiraa/abc4bc36d49725ec14271e9763f1e282 to your computer and use it in GitHub Desktop.
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
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