Typeahead using object name

前端 未结 2 764
耶瑟儿~
耶瑟儿~ 2020-12-30 06:19

I\'m trying to setup a typeahead using AngularJS & UI Bootstrap like so:

.html



        
2条回答
  •  [愿得一人]
    2020-12-30 06:39

    Sure thing :-)

    The typeahead directive from http://angular-ui.github.io/bootstrap/ uses the same super-flexible syntax as the AngularJS select directive for ng-options. So you could write:

    typeahead="stuff as stuff.name for stuff in stuffs | filter:$viewValue"
    

    Here is a working plunk: http://plnkr.co/edit/5kGZkNPZ7rIFfb4Rvxej?p=preview

提交回复
热议问题