title: Unexpected token: D thrown with $http.get()
body: <p>So I have this simple Angular app that I am trying to run, but this error keeps getting thrown: SyntaxError: Unexpected token: D.</p>
  
  <p>Here is the code:</p>
  
  <p>html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" ng-app="spring-learning"&gt;
  &lt;head&gt;
      &lt;base href="/"&gt;
      &lt;title&gt;Index&lt;/title&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
      &lt;meta charset="UTF-8" /&gt;
  
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-route.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-resource.min.js"&gt;&lt;/script&gt;
  
      &lt;script src="angular/app.js"&gt;&lt;/script&gt;
      &lt;script src="angular/routes.js"&gt;&lt;/script&gt;
      &lt;script src="angular/controllers/index.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;header&gt;
          &lt;!-- Header bar--&gt;
      &lt;/header&gt;
  
      &lt;main&gt;
          &lt;div ng-controller="IndexCtrl"&gt;
              &lt;a href="xml" &gt;To XML&lt;/a&gt;
              &lt;p&gt;Greeting: {{ greeting }}&lt;/p&gt;
              &lt;p&gt;The ID is {{greeting.id}}&lt;/p&gt;
              &lt;p&gt;The content is {{greeting.content}}&lt;/p&gt;
          &lt;/div&gt;
          &lt;p&gt;Index&lt;/p&gt;
      &lt;/main&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>js</p>
  
  <pre><code>'use strict';
  
  var app = angular.module('spring-learning', ['ngRoute', 'ngResource']);
  
  app.config([
      '$httpProvider', function($httpProvider) {
          var authToken;
          //authToken = $("meta[name=\"csrf-token\"]").attr("content");
          $httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken;
          //$httpProvider.interceptors.push('InterceptorService');
      }
  ]);
  
  
  app.controller('IndexCtrl', [
      '$scope', '$rootScope', '$location', '$http', function($scope, $rootScope, $location, $http) {
  
          $http.get("rest").
              success(function(data, status, headers, config) {
                  console.log(JSON.parse(data));
                  $scope.greeting = data;
              }).
              error(function(data, status, headers, config) {
  
              });
      }
  ]);
  
  app.config([
      '$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
          $routeProvider.when('xml', {
              templateUrl: 'templates/xml.html',
              controller: 'XmlCtrl'
          }).when('phones/:phoneId', {
              templateUrl: 'partials/phone-detail.html',
              controller: 'PhoneDetailCtrl'
          }).otherwise('/');
  
          $locationProvider.html5Mode(true);
      }
  ]);
  </code></pre>
  
  <p>Some lines have been commented out in $httpProvider config because they seem to not work here, but they did when I used them in my Ruby on Rails developemnt.</p>
  
  <p>But to the matter, when I delete the part <code>$http.get(...)</code>, the error will dissapear. I fail to understand what has gone wrong in my syntax in that get method.</p>