title: Having trouble integrating angular js with wordpress using the rest api
body: <p>Ok so I have included the following files into wordpress in the respective order:</p>
  
  <pre><code>&lt;script type='text/javascript' src='http://localhost/blog/wp-content/themes/my-theme/js/angular-1.6.4/angular.min.js?ver=4.8.1'&gt;&lt;/script&gt;
  &lt;script type='text/javascript' src='http://localhost/blog/wp-content/themes/my-theme/js/angular-1.6.4/angular-resource.min.js?ver=4.8.1'&gt;&lt;/script&gt;
  &lt;script type='text/javascript' src='http://localhost/blog/wp-content/themes/my-theme/js/angular-1.6.4/angular-route.min.js?ver=4.8.1'&gt;&lt;/script&gt;
  &lt;script type='text/javascript'&gt;
  /* &lt;![CDATA[ */
  var localized = {"partials":"http:\/\/localhost\/blog\/wp-content\/themes\/my-theme\/partials\/"};
  /* ]]&gt; */
  &lt;/script&gt;
  &lt;script type='text/javascript' src='http://localhost/blog/wp-content/themes/my-theme/js/my-angular-scripts.js?ver=4.8.1'&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Inside <code>my-angular-scripts.js</code> I have the following:</p>
  
  <pre><code>var myApp = angular.module('myblog',['ngRoute']).config(function($routeProvider, $locationProvider) {
  $routeProvider
  .when('/blog/', {
      templateUrl: localized.partials + 'test.html',
      controller: 'MainCtrl'
  })
  });
  
  myApp.controller('MainCtrl', ['$scope', '$http', function($scope, $http) {
  $http.get('wp-json/wp/v2/posts').then(function(res){
      $scope.posts = res;
  });
  }]);
  </code></pre>
  
  <p>In the header template I have this: </p>
  
  <pre><code>&lt;html &lt;?php language_attributes(); ?&gt; ng-app="myblog"&gt;
  &lt;head&gt;
  </code></pre>
  
  <p>Now inside my front page template file I have this:</p>
  
  <pre><code>&lt;div ng-controller="MainCtrl"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and my partial looks like this: </p>
  
  <pre><code>&lt;div ng-repeat="post in posts"&gt;
  &lt;a href="{{ post.slug }}"&gt;
      {{ post.title }}
  &lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I run it I get an error like this:</p>
  
  <pre><code>Possibly unhandled rejection: {"data":"&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\r\n  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"&gt;\r\n&lt;html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\"&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Object not found!&lt;/title&gt;\r\n&lt;link rev=\"made\" href=\"mailto:postmaster@localhost\" /&gt;\r\n&lt;style type=\"text/css\"&gt;&lt;!--/*--&gt;&lt;![CDATA[/*&gt;&lt;!--*/ \r\n    body { color: #000000; background-color: #FFFFFF; }\r\n    a:link { color: #0000CC; }\r\n    p, address {margin-left: 3em;}\r\n    span {font-size: smaller;}\r\n/*]]&gt;*/--&gt;&lt;/style&gt;\r\n&lt;/head&gt;\r\n\r\n&lt;body&gt;\r\n&lt;h1&gt;Object not found!&lt;/h1&gt;\r\n&lt;p&gt;\r\n\r\n\r\n    The requested URL was not found on this server.\r\n\r\n  \r\n\r\n    The link on the\r\n    &lt;a href=\"http://localhost/blog/\"&gt;referring\r\n    page&lt;/a&gt; seems to be wrong or outdated. Please inform the author of\r\n    &lt;a href=\"http://localhost/blog/\"&gt;that page&lt;/a&gt;\r\n    about the error.\r\n\r\n  \r\n\r\n&lt;/p&gt;\r\n&lt;p&gt;\r\nIf you think this is a server error, please contact\r\nthe &lt;a href=\"mailto:postmaster@localhost\"&gt;webmaster&lt;/a&gt;.\r\n\r\n&lt;/p&gt;\r\n\r\n&lt;h2&gt;Error 404&lt;/h2&gt;\r\n&lt;address&gt;\r\n  &lt;a href=\"/\"&gt;localhost&lt;/a&gt;&lt;br /&gt;\r\n  &lt;span&gt;Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30&lt;/span&gt;\r\n&lt;/address&gt;\r\n&lt;/body&gt;\r\n&lt;/html&gt;\r\n\r\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"wp-json/wp/v2/posts","headers":{"Accept":"application/json, text/plain, */*"}},"statusText":"Not Found"}
  </code></pre>
  
  <p>Now if I go to this url: <a href="http://localhost/blog/wp-json/wp/v2/posts" rel="nofollow noreferrer">http://localhost/blog/wp-json/wp/v2/posts</a>
  I get some JSON objects but only 10 or so, there are > 300 posts in the database.</p>
  
  <p>Anyone know how to solve this.</p>
  
  <p>Cheers</p>