<div class="panel-body" ng-repeat="product in Brands track by $index">
<label>{{product.ID}}</label>
<label style="margin-right: 10px;">{{product.Name}}</label>
<input type="checkbox" ng-model="formData.Selected" ng-true-value='"Y"'
ng-false-value='"N"' value="{{product.Name}}" style="margin-right: 10px;" cd-true-value="'{{product.ID}}'" cd-false-value="'None'" />
这是json数据的一部分
Object {SelectFromDate: Thu Apr 07 2016 00:00:00 GMT+0530 , ToDate: Fri Apr 15 2016 00:00:00 GMT+0530 , Selected: "1"}
{"data":[{"ID":1,"BrandID":1,"ProductID":1,"Name":"***","Created":"****"},{"ID":2,"BrandID":2,"ProductID":1,"Name":"***","Created":"****"},{"ID":3,"BrandID":3,"ProductID":1,"Name":"***","Created":"****"},{"ID":4,"BrandID":4,"ProductID":1,"Name":"***","Created":"****""}, {"ID":5,"BrandID":5,"ProductID":1,"Name":"***","Created":"****"},
这是控制器
$scope.submit = function() {
console.log($scope.formData);
angularService.PostAngularFormData($scope.formData).then(function (response) {
$scope.Brands = JSON.stringify(response);
console.log($scope.Brands);
});
答案 0 :(得分:2)
使用此
$scope.allResponse = JSON.parse(response);
$scope.brands = $scope.allResponse.data;
console.log($scope.brands);
或使用
$scope.brands = angular.fromJson(response.data);
console.log($scope.brands);
答案 1 :(得分:1)
修改控制器
angularService.PostAngularFormData($scope.formData).then(function (response) {
$scope.Brands = response.data;
console.log($scope.Brands);
});
尝试并提供控制台输出
答案 2 :(得分:0)
修改控制器
// I assume you result array
var array = {"data":[{"ID":1,"BrandID":1,"ProductID":1,"Name":"RI","Created":"2016-04-11T23:19:03.463"},
{"ID":2,"BrandID":2,"ProductID":1,"Name":"BLE","Created":"2016-04-11T23:19:03.48"} ]};
$scope.brands = array.data;
内部视图
<div ng-repeat="brand in brands">
{{brand}}
</div>
我的观看输出
{"ID":1,"BrandID":1,"ProductID":1,"Name":"RI","Created":"2016-04-11T23:19:03.463"}
{"ID":2,"BrandID":2,"ProductID":1,"Name":"BLE","Created":"2016-04-11T23:19:03.48"}
尝试并解决您的问题