Last active
April 16, 2020 12:44
-
-
Save CoreProgramm/74d54b5e8e5d75b30ac71d752d08a3e0 to your computer and use it in GitHub Desktop.
Angular ngFor trackBy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { | |
customers: any[]; | |
constructor() { | |
this.customers = [ | |
{ | |
cust_code: 'cust001', cust_name: 'John Smith', Cust_address: 'USA', | |
Cust_phone: '6737540477', Cust_email: 'john.smith@outlook.com', Cust_gender: 'Male' | |
}, | |
{ | |
cust_code: 'cust002', cust_name: 'Lori Orona', Cust_address: 'USA', | |
Cust_phone: '6729837538', Cust_email: 'lori.orona@gmail.com', Cust_gender: 'Female' | |
}, | |
{ | |
cust_code: 'cust003', cust_name: 'Steve Oman', Cust_address: 'UK', | |
Cust_phone: '4252573576', Cust_email: 'steve333@yahoo.com', Cust_gender: 'Male' | |
} | |
]; | |
} | |
getCustomers(): void { | |
this.customers = [ | |
{ | |
cust_code: 'cust001', cust_name: 'Renna Sky', Cust_address: 'USA', | |
Cust_phone: '5426589045', Cust_email: 'renna@outlook.com', Cust_gender: 'Female' | |
}, | |
{ | |
cust_code: 'cust002', cust_name: 'Robin Mathew', Cust_address: 'UK', | |
Cust_phone: '5635875090', Cust_email: 'robin.mathew@gmail.com', Cust_gender: 'Male' | |
}, | |
{ | |
cust_code: 'cust003', cust_name: 'Steve Khan', Cust_address: 'UAE', | |
Cust_phone: '4252573576', Cust_email: 'steve333_k@yahoo.com', Cust_gender: 'Male' | |
}, | |
{ | |
cust_code: 'cust004', cust_name: 'Rubina Mallick', Cust_address: 'Iran', | |
Cust_phone: '2367569086', Cust_email: 'rubina.mallick@yahoo.com', Cust_gender: 'Female' | |
}, | |
{ | |
cust_code: 'cust005', cust_name: 'Rubina Mallick', Cust_address: 'Iran', | |
Cust_phone: '2367569086', Cust_email: 'rubina.mallick@yahoo.com', Cust_gender: 'Female' | |
} | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment