javascript - AngularJS: filter a dropdown directive -
how can filter dropdown directive using custom attribute?
$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"}, ];
directive tag
<keywords supplier-id="supplier.id" keyword-type="marketsegment" title="choose status" label="" array="mykeyword" opt-value="id" opt-description="description"></keywords>
i want filter dropdown marketsegment provided.
i found solution, add filter:keywordtype in directive template. update link
<select ng-model="supplierid" ng-options="a[optvalue] a[optdescription] in array | filter: keywordtype" required>'
Comments
Post a Comment