How to filter a select with ng-options in Angular?

前端 未结 3 1104
暖寄归人
暖寄归人 2021-02-05 03:20

I\'ve written the following proof-of-concept of an Angular app that allows a person to vote for President of the US.




        
3条回答
  •  误落风尘
    2021-02-05 04:04

    a bit late maybe, but for others looking for info I'm using this.

    $scope.deliveryAddresses = data; 
    

    Where data is complex Json id, name and city received from webapi in my Angular controller by $http.get

    I'm using it in my Html page with the following snippet

    ng-options="address.name for address in deliveryAddresses | filter:{name:search} track by address.id
    

    where search is a reference to a textbox. Simple and efficient.

    Hope it helps someone.

提交回复
热议问题