angularJS - add a Static option with ng-options

前端 未结 4 1725
别跟我提以往
别跟我提以往 2020-12-16 23:17

I am using ng-options to print all the options for a form in my angular app. I get the value directly from my database which gives me a list of countries:

&l         


        
4条回答
  •  鱼传尺愫
    2020-12-16 23:41

    This is probably a late post but you should almost never use ng-repeat where ng-options is better suited like this case because new scopes are created in ng-repeat and thus you'd have more overhead.

    The solution to your problem is well written in the angular docs and what you need looks somewhat like

    
    

    With this angular uses the value="" to set a null value and starts iteration from after that value.

提交回复
热议问题