Skip to content Skip to sidebar Skip to footer

Faild To Load - Cross Origin Requests Are- Angular.js 1.x - Ngroute

i know this is already asked question in SO. but my doubt is, when i try i to fetch data from external server i can get it without any problem and i can able to populate the data i

Solution 1:

You cannot get the video resource with $http. In $http instead of using "https://example-url.com/previews/volume1.ogg" as url use "https://example-url.com/json-data" and then change the url of the element.

$http.get(<url-to-load-json-from>).success(function (data){
$scope.medianew = data.media.map(function (m) {
  m.url = $sce.trustAsResourceUrl(m.url); // m.url is the url of the videoreturn m;
});

});

CORS exception was coming as you were fetching media file not json from $http.get.

https://plnkr.co/edit/oXF1oOuNeMvTQPNntP6J?p=preview

Post a Comment for "Faild To Load - Cross Origin Requests Are- Angular.js 1.x - Ngroute"