我需要動態的數據與來自API調用採用NG-重複一系列單選按鈕」需要動態加載NG重複單選按鈕的內部NG-模型
我Controller負載NG-模型:
angular.module('app').controller('apiCallController', [$scope,'$http',function($scope,$http{
$http.get(sampleUrl)
.success(function(data){
$scope.sampleData = animal
});
}]);
HTML:
<div class "row" ng-repeat="animal in animals">
<div class="col-md-1>
<label class="radio-inline">
<input type="radio" name="{{animal.Name}}" id="task1" value="true" ng-model="{{animal.ID}}">
Yes
</label>
</div>
<div class="col-md-1>
<label class="radio-inline">
<input type="radio" name="{{animal.Name}}" id="task1" value="false" ng-model="{{animal.ID}}">
Yes
</label>
</div>
</div>
當我加載了現場,似乎一切正常顯示,但是當我檢查控制檯查看NG-模式的價值就顯示爲「而不是{{animal.ID}}「動物的價值。ID
不知道該怎麼辦。
你的代碼看起來像是有語法錯誤,一些語義錯誤 - 嘗試'apiCallController',['$ scope',' –
謝謝,修復它。 –