How do I set the value property in AngularJS' ng-options?

后端 未结 27 898
感动是毒
感动是毒 2020-11-22 08:17

Here is what seems to be bothering a lot of people (including me).

When using the ng-options directive in AngularJS to fill in the options for a &

27条回答
  •  一生所求
    2020-11-22 08:52

    This is how I resolved this. I tracked the select by value and set the selected item property to the model in my JavaScript code.

    Countries =
    [
        {
            CountryId = 1, Code = 'USA', CountryName = 'United States of America'
        },
        {
           CountryId = 2, Code = 'CAN', CountryName = 'Canada'
        }
    ]
    
    
                            
        
    提交评论

提交回复
热议问题