AngularJS - value attribute for select

前端 未结 8 1884
时光取名叫无心
时光取名叫无心 2020-12-02 09:32

Source JSON data is:

[
  {\"name\":\"Alabama\",\"code\":\"AL\"},
  {\"name\":\"Alaska\",\"code\":\"AK\"},
  {\"name\":\"American Samoa\",\"code\":\"AS\"},
           


        
8条回答
  •  温柔的废话
    2020-12-02 10:24

    you can use

    state.name for state in states track by state.code
    

    Where states in the JSON array, state is the variable name for each object in the array.

    Hope this helps

提交回复
热议问题