AngularJS - value attribute for select

前端 未结 8 1878
时光取名叫无心
时光取名叫无心 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:22

    You could modify you model to look like this:

    $scope.options = {
        "AL" : "Alabama",
        "AK" : "Alaska",
        "AS" : "American Samoa"
      };
    

    Then use

    
    

提交回复
热议问题