Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- @Injectable()
- export class TaskService {
- private tasklist= [{taskname:"sample task",taskdetail:"This is a test task",status:"todo"}];
- constructor() { }
- getTasklist(chosenstatus){
- return this.tasklist.filter((e)=>{
- if(e.status==chosenstatus){
- return e;
- }
- });
- }
- addTask(name,task){
- console.log(this.tasklist);/*this shows new task added*/
- this.tasklist.push({taskname:name,taskdetail:task,status:"todo"});
- }
- }
- ngOnInit() {
- this.todoService=this.taskService.getTasklist(this.sts);
- }
Add Comment
Please, Sign In to add comment