how to fetch the nested json array and show in click function




Asked on July 05, 2018
html
-----
<tbody>
 <tr *ngFor="let application_category of dashboard_data?.application_info?.category;let i=index;l">
         <td>{{i+1}}</td>
         <td>{{application_category.label}}</td>
</tbody>

<tbody>
       <tr *ngFor="let k=index">
         <td>{{k+1}}</td>
         <td>code_type</td>                                    
        </tr>
</tbody>

ts
----
 getManageDashboardDetails(){
    this.loaderService.display(true);
  
   const headers = new Headers({
   'Authorization': localStorage.getItem('Token'),
   'Content-Type': 'application/json'
  });
  const options = new RequestOptions({
   headers: headers
  });
     this.service.get(options, services.dashboard_service).subscribe((response) => {
     if (response.status === 200) {
         this.dashboard_data = response.json().dashboard_details;
       this.generateChart();
         this.loaderService.display(false);
        }

      }, (err) => {

    })
  }
json
------
    "category": [
                {
                    "application": [
                        {
                            "image": "image",
                            "status": "disable",
                            "code_type": "sparkr_code"
                        },
                        {
                            "image": "image",
                            "status": "disable",
                           "code_type": "sparkr_code"
                        },
                        {
                            "image": "image",
                            "status": "disable",
                           "code_type": "sparkr_code"
                        }
                    ],
                    "total_app_count": 12,
                    "enable_app_count": 4,
                    "name": "retail",
                    "label": "Retail",
                    "status": "enable"
                },
                {
                    "application": [
                        {
                            "image": "image",
                            "icon_name": "icmn-user-check",
                           "code_type": "R_code"
                        },
                        {
                            "image": "image",
                            "status": "disable",
                            "code_type": "R_code"
                        },
                        {
                            "image": "image",
                            "icon_name": "icmn-star-full",
                            "code_type": "R_code"
                        },
                    ],
                    "total_app_count": 8,
                    "enable_app_count": 0,
                    "name": "finance",
                    "label": "Finance",
                    "status": "disable"
                },
                ]

Hi, i have to fetch the code_type from json and show , when i click the <td>{{application_category.label}}</td> using click function.
       R_code will display in <td>code_type</td> when i click <td>{{application_category.label}}</td>



Replied on July 05, 2018
anyone help



Replied on July 06, 2018
Try this

<tbody>
       <tr *ngFor="let app_item of application_category?.application; let k=index">
         <td>{{k+1}}</td>
         <td>{{app_item.code_type}}</td>                                     
       </tr>
</tbody>


Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us