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 in table with ng-repeat. but once again am doing the same to get some other data(audio – .ogg) with different url it showing Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-

am using ngRoute for below $http i can get data.

app.controller('HomeController', function($scope) {
  $scope.message = 'Hello from HomeController';
           .then(function(response) {
               $scope.externalAPIData =;
               $scope.sortByTitle     = 'title';
               $scope.searchByUserName   = '';
               $scope.sortReverse  = false;

same approach is not working for below

app.controller('BlogController', function($scope,$http) {
  $scope.message = 'Hello from BlogController';
  $http.get('' ).success(function (data){
    $scope.medianew = (m) {
      m.url = $sce.trustAsResourceUrl(m.url);
      return m;


for that i try to access the data from given url, i just change it to call from my local json as below

    "audioSourceName": "sample 1",
  }, {
   "audioSourceName": "sample 2",
  } ]

to achieve above, i know I’ve to do some server works(node.js) but no idea about that.
this is what i referred to achieve locally
i don’t know why the same approach has throwing CROS error for different url.

pls don’t down vote it.

fiddle or plunker example would helpful to understand.

Thanks all


You cannot get the video resource with $http.
In $http instead of using “” as url use “” and then change the url of the element.

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


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

Answered By – Amit Dhaka

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.