Home  >  Forum  >  Angular
Post New Query

How to fetch array of array data in angular 2.



Asked on December 11, 2017

How to fetch array of array data in angular 2.

My json data is as follows,

[[{"pk_emp_id":5,"tenant_id":"Zone1","location_id":1,"emp_number":"sk44","prefix":"","first_name":"qqqqq","middle_name":"www","last_name":"eeee","display_name":"qqqq","full_name":"qqq qqqq","email":"qqqq@gmail.com","gender":"Female","emp_type_id":2,"date_of_hire":191000,"date_of_birth":null,"manager_id":7,"phone_number":"9877654","position":"SE","responsibility":"","notes":"","contracted":"0","street":"vidyanagar","state":"Karnataka","city":"hubli","zip_code":"9898","dob":-19800000,"ssn":"","deleted":0},{"pk_empt_id":2,"empt_tenant_id":"2","empt_name":"temporary","deleted":0}] ]

I want to fetch empt_name in datatable(row data). Can any one help me out?




Replied on December 11, 2017
First go to the URL


Now suppose you want array of array of Employee

You need to create a class for example Data

export class Data {
 employees: Employee[];
}
 
and then use Data class with Observable

getBooksWithObservable(): Observable<Data[]> {
    return this.http.get(this.url).map(this.extractData);



Write Answer




©2019 concretepage.com | Privacy Policy | Contact Us