Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as TypeScript by nickbanana ( 7 years ago )
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { CustomerListService } from '../../shared/customer-list.service';
import { Customer } from '../../shared/customer';

@Component({
  selector: 'app-customer-list',
  templateUrl: './customer-list.component.html',
  styleUrls: ['./customer-list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CustomerListComponent implements OnInit {
  customers: Customer[] = [];

  constructor(protected customerlistService: CustomerListService) {

   }

  ngOnInit() {
    this.ShowList();
    console.log('init');
  }

  ShowList(): void {
    this.customerlistService.getData()
        .subscribe((results: Customer[]) => {this.customers = results; console.log(this.customers); });

  }

}

 

Revise this Paste

Your Name: Code Language: