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; } )}}
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.