2017-04-18 92 views

回答

0

您可以使用@input進行此類處理。

假設不同的組件有一些關鍵過濾城市組件的城市。

你可以參考以下:

第1步:

區組件作爲綁定:

<district-component-selector [cityListInput]="cityList"></district-component-selector> 

其中, cityList持有組件的城市完整列表。

步驟2:

在區組件,你可以參考它:

import { Input } from "@angular/core"; 
@Input() set cityListInput(value: String[]) { 
this.cityList= value; 
} 

其中, cityList在區組件的局部變量。

相關問題