2017-08-09 28 views
1

我需要加載一個表格,其中載有從帖子中獲取的信息的下拉列表,但是當選擇下拉選項時,我需要發送某些參數以發送到帖子並將信息返回給我和裝載表使用角度下拉菜單加載表格4

+0

幫助我什麼.. !!請 –

+0

向我展示您的代碼,您想要發送參數並從發佈請求中獲取詳細信息,還要顯示代碼要載入數據的位置? –

回答

0

概述溶液

元器件

myValue:number; 
    tableData:any; 
    selectedValue:number; 

    select(value : number){ 
    // you get the selected value from the drop down 
    Make a Http call to service here like 
    getMyTable(value).subscribe(data => this.tableData = data); // passing value as parameter 

    } 

Templa TE

<select [(ngModel)]="selectedValue" (change)="select($event.target.value)"> 
    <option *ngFor="let value of values " value= {{value.id}}>{{value.name}}</option> 
</select> 

<div *ngIf = "tableData"> // this will load data when your table data has value else will not be shown 
    // table data 
</div> 

希望這是你想要