2016-10-21 88 views
0
<select ng-option="ubrandname as ubrandname.brand for brand in ubrandname track by ubrandname.brand" ng-model="ubrandname"></select> 

這是我調用動態數據集從我js文件呼叫在下拉列表NG選項動態數據angularjs

//brandnamebyid 
      $http.get('/brandinfo.asmx/getbrandname', { 
       params: { 
        log: log, 
        pm: pm, 
        id: $scope.updateparam.Id 
       } 
      }) 

      .then(function (response) { 
       { 
        $scope.brandfunction = response.data.branddetails; 
        $scope.ubrandname = $scope.brandfunction[0]; 
        console.log($scope.ubrandname); 
       } 
      }); 

我想我不能寫NG選項的正確語法下拉列表在我的下拉列表中,任何人都可以在這裏幫助我嗎?

回答

0

你的ng-model和ng-option數據源看起來是一樣的。請嘗試如下,

<select ng-option="brand as brand.brand for brand in brandfunction track by $index" ng-model="ubrandname"></select> 
0

試試這個

<select ng-model="ubrandname"> 
    <option ng-repeat="brandname in brandfunction" value="{{brandname}}">{{brandname}}</option> 
</select> 
相關問題