ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 255.1k

How add nested loop to menu component without use table ?

May 2 2020 3:33 AM
I work on angular 7 with asp.net core 2.2 app new project and i have component inside project 
 
I need to add menu in place of table to display dynamic menu
 
meaning i dont need to use table and i need to use menu
 
so i need to add nested loop below to menu i because i use dynamic menu .
 
but i dont know how to add nested loop below  to menu  
 
  1. <p>report-category works!</p>  
  2. <table *ngFor="let rep of reportlist">    
  3.      <tr>  
  4.               
  5.             <td>{{rep.reportCategory}}</td>         
  6.     </tr>  
  7.     <tr *ngFor="let subrep of subreportlist">  
  8.         <div *ngIf="subrep.reportCategoryID === rep.reportCategoryID">  
  9.                 <td>{{subrep.reportName}}</td>  
  10.         </div>  
  11.                   
  12.                   
  13.        </tr>  
  14.               
  15.              
  16.          
  17. </table>  
 
  1. import { Component, OnInit } from '@angular/core';  
  2. import { DisplayreportService } from '../displayreport.service'  
  3. import { HttpClient } from '@angular/common/http';  
  4. import { Router , ActivatedRoute} from '@angular/router';  
  5. import { report } from '../report.model';  
  6. @Component({  
  7.   selector: 'app-report-category',  
  8.   templateUrl: './report-category.component.html',  
  9.   styleUrls: ['./report-category.component.css']  
  10. })  
  11. export class ReportCategoryComponent implements OnInit {  

  12. datalis:string;  
  13. reportlist:any[];  
  14. subreportlist:any[];  
  15.   constructor(public http: HttpClient, private _router: Router, private _displayreport: DisplayreportService) { }  
  16.   
  17.   ngOnInit() {  
  18.       
  19.     console.log(this._displayreport.GetReports()) ;  
  20.    
  21.        this._displayreport.GetReports().subscribe((data: any[]) => {    
  22.         this.reportlist = data;    
  23.         
  24.       });    
  25.       this._displayreport.GetsubReports().subscribe((data: any[]) => {    
  26.         this.subreportlist = data;   
  27.       });  
  28.   }  
  29.   
  30. }  

Answers (1)