title: AngularJS: Can't use JSON
body: <p>Here is the JSOn file that is retrived from my API:</p>
  
  <pre><code>{  
     "pid":12925,
     "a":"How is this a palindrome hexagon oriennted? (digits should not be repeated)",
     "c":"",
     "opts":{  
        "A":"216",
        "B":"69",
        "C":"72",
        "D":"96",
        "answer":"X"
     },
     "ansDetails":{  
        "ans":"&lt;p&gt;This is question is invalud&lt;/p&gt;",
        "ansPid":null,
        "pt":"X"
     }
  }
  </code></pre>
  
  <p>The angular code that i wrote:</p>
  
  <p>Controller:</p>
  
  <pre><code>testControllers.controller('DetailsController', ['$scope', '$http','$routeParams' ,function($scope, $http, $routeParams) {
    $http.get('http://url_of_theapi').success(function(data) {
    $scope.questions = data;
      $scope.parseInt = parseInt;
    });
  }]);
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;section class="a"&gt;
      &lt;div class="mcq"&gt;
        &lt;div&gt;
          &lt;h3&gt;QUESTION&lt;/h3&gt;
          &lt;p class&gt;{{questions.pid}}&lt;/p&gt;    
       &lt;ul&gt;
                &lt;li class= "optlist" ng-repeat="item in questions.opts"&gt;
                &lt;label class="formgroup"&gt;
                &lt;input type="radio" name = "q"&gt;
                {{item.val}}
               &lt;/label&gt;
               &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>How do I fix this? Is this an Issue of Angular or the JSON?</p>
  
  <p>The problem: The data from the JSON is not getting displayed.</p>
  
  <p><strong>Update</strong>: The error is due to:</p>
  
  <p><em>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <a href="http://url_of_api" rel="nofollow">http://url_of_api</a>. (Reason: CORS header 'Access-Control-Allow-Origin' missing).</em></p>
  
  <p>How do I fix this?</p>