Created
November 7, 2015 05:31
-
-
Save jonathansolorzn/aaa3c17cf7f1b37706ff to your computer and use it in GitHub Desktop.
Factory for READ products data.
This file contains 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
(function () { | |
'use strict'; | |
angular | |
.module( 'app.purchases.products' ) | |
.factory( 'ReadProductFactory', ReadProductFactory ); | |
ReadProductFactory.$inject = [ 'Restangular' ]; | |
function ReadProductFactory( Restangular ) { | |
return { | |
detailProduct: detailProduct, | |
listProducts: listProducts | |
}; | |
function detailProduct( data, success, fail ) { | |
Restangular | |
.one( '/purchases/products/', data.id ) | |
.all( '/detail' ) | |
.getList() | |
.then( success, fail ); | |
} | |
function listProducts( data, success, fail ) { | |
Restangular | |
.all( '/purchases/products/list' ) | |
.getList() | |
.then( success, fail ); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment