答案 0 :(得分:0)
它会告诉您如何在链接的页面上正确执行此操作:
(selected)="selected($event)"
您可以使用它的简单版本:
<ng-select [items]="itemsState"
(selected)="selectedState($event)"
placeholder="No state selected">
</ng-select>
<ng-select [items]="itemsCity"
(selected)="selectedCity($event)"
placeholder="No city selected">
</ng-select>
在您的代码中,您有不同的选择方法:
selectedState($event) {
// filter itemsCity somehow or whatever you want
console.log($event.text);
}
selectedCity($event) {
console.log($event.text);
}