import { HttpClient } from "@angular/common/http" ; import { Component , OnInit } from '@angular/core' ; import { NzMessageService } from "ng-zorro-antd" ; const todoUrl = 'http://localhost:3000/todos' ; @ Component ( { selector : "app-todos-list" , templateUrl : "./todos-list.component.html" , styleUrls : [ "./todos-list.component.css" ] } ) export class TodosListComponent implements OnInit { loading = true ; loadingMore = false ; showLoadingMore = true ; data = [ ] ; constructor ( private http , private msg ) { } ngOnInit ( ) { this . getData ( ( res ) => { this . data = res ; this . loading = false ; } ) ; } getData ( callback ) { this . http . get ( todoUrl ) . subscribe ( ( res ) => callback ( res ) ) ; } edit ( item ) { this . msg . success ( item . text ) ; } }