ngResource GET with param



examples/angular/resource_v2_reverse.html
<script src="angular.min.js"></script>
<script src="angular-resource.min.js"></script>
<script src="resource_v2_reverse.js"></script>

<div ng-app="DemoApp" ng-controller="DemoController">
<input ng-model="str"> <button ng-click="reverse()">Reverse</button>
    Reversed: {{res.text}}
<hr>
<div ng-show="error">Error! Check the console.</div>
</div>

examples/angular/resource_v2_reverse.js
angular.module("DemoApp", ["ngResource"])
.controller("DemoController", ['$scope', '$resource', function($scope, $resource) {
    var Greeting = $resource('http://127.0.0.1:3000/api/v2/reverse');

    $scope.reverse = function() {
        $scope.res = Greeting.get({ str: encodeURIComponent($scope.str) },
            function(){ }, 
            function(resp) {
                console.log('error');
                console.log(resp);
                $scope.error = true;
            }
        );
        console.log($scope.res);
    };
}]);