2017-04-18 93 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在区组件的局部变量。

相关问题