I'm trying to create a demo usage of an api in angularjs and I came across this problem.
My Code looks like this:
app.js and index.html
var app = angular.module("ytsApp",['ngRoute','ngResource']);
app.controller('MoviesCtrl',['$scope','movies',function($scope,movies){
    movies.get(function(data){
        alert(data);
    });
}]);
app.factory('movies',['$resource',function($resource){
    return $resource('https://yts.ag/api/v2/list_movies.json',{
        'sort_by': 'year',
        'limit': '15'
    },{
        'load': {
            method: 'GET',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        }
    });
}]);<!DOCTYPE html>
<html ng-app="ytsApp">
    <head>
        <title>The Official Home of YIFY Movie Torrent Downloads - YIFY</title>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular-route.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular-resource.js"></script>
    </head>
    <body ng-controller="MoviesCtrl">
        <script type="text/javascript" src="js/app.js"></script>
    </body>
</html>This is the result that is getting displayed in the console while I open that page:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://yts.ag/api/v2/list_movies.json?limit=15&sort_by=year. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
I have searched here and there and tried to edit the headers in several ways and couldn't crack it. I appreciate if anyone help me out with this.
 
    