angularjs - Angular $resource - attach a generic .finally function to a method -


I have a simple comfortable resource with the $ angular resource, on any saved method, in whatever field I I also want to set a message and boolean, and set an expiration for that message, anywhere in my code where I call. Save /. Save $ I, I attach it again. (Down) on

Instead of putting instead. Wondering whether I can actually write on the actual resource at the end, and it can be a normal end to my saved ceremony


  var resource = $ resource (pageListPath) , {}: {Query: {method: 'GET', isArray: true}, get: {method: 'GET', url: page wizard, parameter: {id: 'id}}, cache: true} : {method: 'PUT', url: page Schepth parameters: {id: 'id}}, Delete: {method:' DELETE ', Url: page DetailPath, Params: {id:' @ id '}}}) ; Return processing;  

 . Finally (function () {$ scope.loading = false; $ timeout (function () {$ scope.message = false;}, 2500);});  

Ideally something

  save: {method: 'PUT', url: pageSavePath, params: {id: 'id'} , At the end: function () {doStuff ()}}  

is what I see is it possible?

I have finished writing another services that explain this one, for some reactions Providing general functionality

API service:

  pageServices.factory ( 'PageAPI', [ '$ resource', function ($ resource, diversified resources = $ resource (Pejlistpath, {}, {Query: {method: 'GET', isArray: true}, get: {method: 'GET', url: pageDetailPath, params: {id: '@ id'}} ... ..., ... }); return resource;}]); page Services Forencr ( 'page', [ 'page API', function (Pejapiai) {var service = { 'getpages': function ()} return page Apiaikkyuri (function ( Response) {// Work with success}, function (error) {// handle error}). $ Promise. (Function (at the end) {// generic ultimately handler}}, ..., ...,} return service}])  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

c# - WPF Expander overlay used in ItemsControl -

android - how to get distance of 2 beacons and make a condtion base on that distance -