0

这是我的代码

如何使用自定义属性过滤我的下拉指令?

$scope.myKeyword = [
        {Id: 1, Keyword:"ActivityType", Description: "Active"}, 
        {Id: 2, Keyword:"ActivityType", Description: "InActive"}, 
        {Id: 3, Keyword:"ActivityType", Description: "Deleted"},
        {Id: 4, Keyword:"MarketSegment", Description: "Fashion"},
        {Id: 5, Keyword:"MarketSegment", Description: "IT"},
        {Id: 6, Keyword:"MarketSegment", Description: "F&B"},
        {Id: 7, Keyword:"MarketSegment", Description: "Manufacturing"},
    ];

指令标签

<keywords supplier-id="supplier.Id" keyword-type="MarketSegment"  title="Choose Status" label="" array="myKeyword" opt-value="Id" opt-description="Description"></keywords>

我想按提供的 MarketSegment 过滤下拉列表。

4

1 回答 1

1

我找到了解决方案,只需在指令模板中添加 filter:keywordType 即可。这是更新链接

<select ng-model="supplierId" ng-options="a[optValue] as a[optDescription] for a in array | filter: keywordType" required>'
于 2013-09-05T08:14:58.797 回答