We help IT Professionals succeed at work.

error in angular app

hi am having error in my angular component
todos
import { Component, OnInit } from '@angular/core';
import { TodoDataService } from '../service/data/service/data/todo-data.service';


export class Todo {
  constructor(
    public id: number,
    public description: string,
    public done: boolean,
    public targetDate: Date
  ){

  }
}


@Component({
  selector: 'app-list-todos',
  templateUrl: './list-todos.component.html',
  styleUrls: ['./list-todos.component.css']
})
export class ListTodosComponent implements OnInit {

   todos = Todo
  //   new Todo(1,'Learn to Dance',false,new Date()),
  //   new Todo(2,'Become Expert in angualr',false,new Date()),
  //   new Todo(3,'Visit South Africa',false,new Date())

    //  {id : 1,description :'Learn to Dance'},
    //  {id : 2,description :'Become an Expert in Angular'},
    //  {id : 3,description :''},
  
//  ]
    
  // todo = {
  //      id : 1,
  //      description: 'Learn to dance'

  // }

  constructor(private todoservice:TodoDataService ) { }

  ngOnInit() {
    this.todoservice.retriveAllTodos('tshifhiwa')
    .subscribe( 
        response => 
            { 
                console.log(response); 
                this.todos = response; 
            } 
    )
}
}
   

Open in new window

Comment
Watch Question

Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
Line 24
todos = Todo

Open in new window

Should be
todos:Todo;

Open in new window