belle-workbook
belle-workbook
belle-workbook
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Create a Person ResourceNow that we have the serverside in place, and a Url to call, we will setup a service to retrieveour data. As an Umbraco specific convention, we call these services a *resource, so we alwayshave an indication what services fetch data from the DB.Create a new file as person.resource.js and add://adds the resource to umbraco.resources module:angular.module(‘umbraco.resources’).factory(‘personResource’,function($q, $http) {//the factory object returnedreturn {//this cals the API Controller we setup earliergetAll: function () {return $http.get("My/PersonApi/GetAll");}};});This uses the standard angular factory pattern, so we can now inject this into any of ourcontrollers under the name personResource.The getAll method just returns a $http.get call, which handles calling the url, and will returnthe data when its ready.