How do I get the ng-model of a select tag to get the initially-selected option?

前端 未结 6 1744
一个人的身影
一个人的身影 2021-01-13 06:41

I\'m pretty new to Angular, so I may be going about this all wrong...

I have a

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 07:37

    It works a whole lot better when you use ng-options on your select element instead of nesting option with ng-repeat.

    https://docs.angularjs.org/api/ng/directive/select

    Then you are capable of setting the ng-model with ng-init.

提交回复
热议问题