Guest User

Untitled

a guest
Apr 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import { Injectable } from '@angular/core';
  2.  
  3. @Injectable()
  4. export class TaskService {
  5. private tasklist= [{taskname:"sample task",taskdetail:"This is a test task",status:"todo"}];
  6.  
  7. constructor() { }
  8.  
  9. getTasklist(chosenstatus){
  10. return this.tasklist.filter((e)=>{
  11.  
  12. if(e.status==chosenstatus){
  13.  
  14. return e;
  15.  
  16. }
  17. });
  18.  
  19. }
  20.  
  21. addTask(name,task){
  22. console.log(this.tasklist);/*this shows new task added*/
  23. this.tasklist.push({taskname:name,taskdetail:task,status:"todo"});
  24. }
  25.  
  26. }
  27.  
  28. ngOnInit() {
  29. this.todoService=this.taskService.getTasklist(this.sts);
  30. }
Add Comment
Please, Sign In to add comment