0
我正在从Angular JS进行Rest调用。一旦我得到API的响应。我打算使用ng-repeat在前端填充消息。这是我的控制器端调用。无法使用Angular JS中的ng-repeat从REST API填充值
$http({
url: "http://localhost:8080/services/AddConfig",
method: "POST",
data: dataobj,
headers: {
'Content-Type': 'application/json'
}
}).success(function(data, status, headers, config){
responseData = data;
$scope.dbresponse = responseData;
console.log(responseData);
console.log($scope.dbresponse[0].messages);
console.log($scope.dbresponse[0].errors);
if($scope.dbresponse[0].messages[0] != null){
console.log("success message");
console.log("After Setting it");
}else if ($scope.dbresponse[0].errors != null){
console.log("has errors throw validation message");
}
}).error(function(error){
alert("Please Try again");
});
这是我的repsonse在控制台
Object
errors:null
messages:Array[1]
0:Added Successfully
所看到我想要做的是访问该消息并使用NG重复做,它的失败在前端.I'm填充。
这是我的HTML
<table>
<tr ng-repeat="messages in dbresponse.messages">
<td align="left" class="validMsg"><img src="images/red_bullet.gif" border="0" width="8" height="8" alt=""> {{messages}}</td></tr>
</table>
嘿菲利普,这是一个错字。我正在尝试使用ng-repeat像这样
相关问题