- ngResource
Using ngResource
examples/angular/resource_v2_get.html
<script src="angular.min.js"></script> <script src="angular-resource.min.js"></script> <script src="resource_v2_get.js"></script> <div ng-app="DemoApp" ng-controller="DemoController"> {{res.text}} </div>
examples/angular/resource_v2_get.js
angular.module("DemoApp", ["ngResource"]) .controller("DemoController", ['$scope', '$resource', function($scope, $resource) { var Greeting = $resource('http://127.0.0.1:3000/api/v2/greeting'); $scope.res = Greeting.get(); }]);