Last active
August 29, 2015 14:19
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @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