I am making an Rest call from Angular JS. once i get the response from the API . I am planning to Populate Messages on the Front end using ng-repeat .This is my controller side call .
$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");
});
This is My repsonse as seen on Console
Object
errors:null
messages:Array[1]
0:Added Successfully
What i want to do is access that message and populate on the front end .I'm using ng-repeat to do and its failing.
this is my 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>