User interface for customers

Now that we have the REST endpoints in place, we are now able to call them from AngularJS! To create a service for login, logout, and register, it only needs to interact with $resource, from AngularJS, to call the REST endpoints as shown in the following code:

angular.module('user.services', ['ngResource']). service('User', function ($resource) { var loadUser = function (success) { $resource('/chapter10/rest/account').get(function (userData) { if (userData.userId) { if (success) { success(userData); } } }); }; this.register = function (user, success, error) { $resource('/chapter10/rest/account/register').save(user, function (response) { if (response.success) { success(); } else { error(); } }, error); }; this.login ...

Get JBoss Weld CDI for Java Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.