$http GET request with CORS enabled



examples/d2/angular_v2_greeting.html
<script src="../angular/angular.min.js"></script>
<script src="angular_v2_greeting.js"></script>
<div ng-app="DemoApp" ng-controller="DemoController">
        {{greeting}}
        <hr>
    <div ng-show="error">Error! Check the console.</div>
</div>

examples/d2/angular_v2_greeting.js
angular.module("DemoApp", [])
.controller("DemoController", ['$scope', '$http', function($scope, $http) {
    $http.get('http://127.0.0.1:3000/api/v2/greeting').then(
        function(response) {
            console.log(response);
            $scope.greeting = response.data["text"];
            $scope.error = false;
        },
        function(response) {
            console.log("error");
            console.log(response);
            $scope.error = true;
        }
    );
}]);