Hi,
I need to create a function that verify if the user can buy a thing.
This verification is a HTTP POST to an API.
How can I create a factory/service to make an API call and depending of the
result, return true or false.
This function will be used in a controller like this:
if (CheckoutService.canBuy) {
// ok
} else {
alert("Error");
}
I think I need to use a promise to do that.
Somebody can help me on this ?
Thank you.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.