Hi, I got stuck with the cross domain task, where i have a url of a xml file which consist of some data . My task is to fetch the data from the url i.e, xml file which should be displayed in a drop down list .And the problem is ,the program which i have posted here allows the url which consist json format file but its not responding for the xml file .So, i will be thankful if some one help me with this...
---index.html---
<!DOCTYPE html>
<html ng-app="App">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"> </script>
<script src="script.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div ng-controller="AppCtrl">
<h1>{{val}}</h1>
<select ng-options="p.ProductName for p in Product" ng-model="blah"></select>
</div>
</body>
</html>
---script.js---
var App = angular.module('App',[])
.controller('AppCtrl', function($scope, AppFact) {
$scope.val = "Testing the Page For CallsBacks";
AppFact.getData(function(Product) {
$scope.Product = Product;
});
})
.factory('AppFact', function($http) {
return {
getData: function(successcb) {
var url = 'http://xxxxxxxx';
$http.jsonp(url).
success(function(Product,status,headers,config) {
alert(Product);
console.warn(Product);
successcb(Product);
}).
error(function(Product, status,headers, config) {
});
}
};
});
//var url = 'http://filltext.com/?callback=JSON_CALLBACK&rows=10&fname={firstName}&lname={lastName}'this is a json url which works fine .
And the other url is what i needed to be worked and it consist of xml file ,And i'm not suppose to display the original url so i have given as var url = 'http://xxxxxxxx' . Plz help me wit this ....
Here is my plunker:http://plnkr.co/edit/qq8sELDdZZB5QKe1Pj3T?p=preview