希望有人可以帮助应对这一挑战。
我在两个构建单独的下拉列表中使用了 1 个机场阵列。
<select data-ng-model="flightData.origin" data-ng-options="airport.code as airport.label for airport in flightData.airports" name="origin"></select>
和
<select data-ng-model="flightData.destination" data-ng-options="airport.code as airport.label for airport in flightData.airports" name="destination"></select>
这两个列表显然具有相同的选项。我想做的是当您选择例如"Sydney"
在来源中时,"Sydney"
从目标下拉列表中删除。
作为参考,这是机场数据的示例。
this.airports = [{
code: "TSV",
label: "Townsville",
}, {
code: "PER",
label: "Perth",
}, {
code: "BNE",
label: "Brisbane",
}, {
code: "MEL",
label: "Melbourne",
}, {
code: "KGI",
label: "Kalgoorlie",
}, {
code: "SYD",
label: "Sydney",
},{
code: "LAX",
label: "Los Angeles",
}, {
code: "JFK",
label: "New York",
}, {
code: "DEL",
label: "New Dehli",
}];
我知道我很可能需要两个单独的数组(1 个用于起点,1 个用于目的地),只是不知道如何处理它。
谢谢!