examples/d2/angular_v2_reverse.html
<script src="../angular/angular.min.js"></script>
<script src="angular_v2_reverse.js"></script>

<div ng-app="DemoApp" ng-controller="DemoController">
    <input ng-model="str"> <button ng-click="reverse()">Reverse</button>
    Reversed: {{reversed}}
    <div ng-show="error">Error! Check the console.</div>
</div>
examples/d2/angular_v2_reverse.js
angular.module("DemoApp", [])
.controller("DemoController", ['$scope', '$http', function($scope, $http) {
    $scope.reverse = function() {
        $http.get('http://127.0.0.1:3000/api/v2/reverse?str='
               + encodeURIComponent($scope.str)).then(
            function(response) {
                console.log(response.data);
                $scope.reversed = response.data["text"];
            },
            function(response) {
                console.log("error");
            }
        );
    }
}]);