javascript - AngularJS: filter a dropdown directive -


here code

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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -