I am learning angularjs.
When i want to access xml file,i am unable to do it i used xml_strjson this method is converting the data xml to json but unable to access in html file here is my code:
enter code here<!DOCTYPE html>
<html ng-app="">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"> </script>
<script type="text/javascript" src="http://demos.amitavroy.com/learningci/assets /js/xml2json.js" charset="UTF-8"></script>
<script>
function customersController($scope, $http) {
$http.get("http://localhost:13087/Data.xml")
.success(function (response) {
$scope.lstComapanies = x2js.xml_str2json(response);
console.log($scope.lstComapanies);
alert(response);
});
}
</script>
<title></title>
</head>
<body ng-controller="customersController">
<table>
<tbody>
<tr ng-repeat="CompanyModel in lstComapanies">
<!-- $index for duplicate values -->
<td class="border">
<label>{{ CompanyModel }}</label>
</td>
</tr>
</tbody>
</table>
my json data
{
"__cnt": 8,
"CompanyModel": [
{
"__cnt": 7,
"BacklogSum": "646",
"BacklogSum_asArray": [
"646"
],
"BillingSum": "607",
"BillingSum_asArray": [
"607"
],
"BookingSum": "646",
"BookingSum_asArray": [
"646"
],
"CashflowSum": "$-4809038.45",
"CashflowSum_asArray": [
"$-4809038.45"
],
"LstCompanies": {
"__cnt": 1,
"_i:nil": "true"
},
"LstCompanies_asArray": [
{
"__cnt": 1,
"_i:nil": "true"
}
],
"Name": "OPTERNA AM, INC. ",
"Name_asArray": [
"OPTERNA AM, INC. "
],
"Number": "2000",
"Number_asArray": [
"2000"
]
}
],
"_xmlns:i": "http://www.w3.org/2001/XMLSchema-instance",
}