Javascript 根据angular2 multiselect的国家和州选择填充州和城市

Javascript 根据angular2 multiselect的国家和州选择填充州和城市,javascript,angular,Javascript,Angular,我想根据国家选择加载州和城市。我正在使用服务从json文件加载json数据 . 我已经在stacblitz创建了完整的代码,这里是url 请根据以下国家/地区帮助我了解此加载状态 用getCountries()写下这个 声明下面的变量 allCountries:any = []; 编写选择国家/地区的代码 onItemSelect1(item: any) { console.log(item); console.log(this.selectedItems1); thi

我想根据国家选择加载州和城市。我正在使用服务从json文件加载json数据 . 我已经在stacblitz创建了完整的代码,这里是url
请根据以下国家/地区帮助我了解此加载状态

用getCountries()写下这个

声明下面的变量

allCountries:any = [];
编写选择国家/地区的代码

onItemSelect1(item: any) {
    console.log(item);
    console.log(this.selectedItems1);
    this.dropdownList2 = this.allCountries.map(x=>item.itemName == x.CountryName);
    console.log(this.dropdownList2);//implement in your state dropdown
  }

请检查你的stackblitz代码,不起作用。
onItemSelect1(item: any) {
    console.log(item);
    console.log(this.selectedItems1);
    this.dropdownList2 = this.allCountries.map(x=>item.itemName == x.CountryName);
    console.log(this.dropdownList2);//implement in your state dropdown
  }