Angularjs populate select options with json

前端 未结 4 1047
暗喜
暗喜 2021-02-09 04:54

I am looking to populate select option with values from a basic json array.

The example I have is a country select. Each country has an id element and a name plus other

4条回答
  •  时光说笑
    2021-02-09 05:36

    You miss-typed the value attribute, change it to country.countryId.

    Also, set ng-model directive to a single countryId value (or array of country IDs) instead of the full object.

    
                            
        
    提交评论

提交回复
热议问题