Skip to content

Instantly share code, notes, and snippets.

@shahariaazam
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save shahariaazam/3e0cb39cc4908876b1f3 to your computer and use it in GitHub Desktop.

Select an option

Save shahariaazam/3e0cb39cc4908876b1f3 to your computer and use it in GitHub Desktop.
AngularJS Resource Sample codes - Created for http://blog.shahariaazam.com/AngularJS-Resource-use-for-RESTful-apps/
/**
* @author Shaharia Azam <shaharia.azam@gmail.com>
*/
angular.module('services', ['ngResource']).
factory("notesService", function ($resource) {
return $resource('/notes');
});
var app = angular.module('myApp', ['ngResource', 'services']);
app.controller('MainController', ['$scope', 'notesService',
function ($scope, svc) {
svc.get(function (data) {
$scope.data = data;
}, function () {
console.log('FAILURE');
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment