Full Stack AngularJS for Java Developers by Ravi Kant Soni

Full Stack AngularJS for Java Developers by Ravi Kant Soni

Author:Ravi Kant Soni
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


$scope.submitUserForm = function() {

$http({

method : 'POST',

url : 'http://localhost:8080/api/user/',

data : $scope.user,

}).then(function(response) {

$location.path("/list-all-users");

$route.reload();

}, function(errResponse) {

$scope.errorMessage = errResponse.data.errorMessage;

});

}

$scope.resetForm = function() {

$scope.user = null;

};

});

Listing 3-13. registerUserController in src/main/resources/static/js.controller.js

Similarly, you have defined listUserController and usersDetailsController to consume the REST API developed in Chapter 2. Listing 3-14 shows listUserController, and Listing 3-15 shows usersDetailsController.

app.controller('listUserController', function($scope, $http, $location, $route) {

$http({

method : 'GET',

url : 'http://localhost:8080/api/user/'

}).then(function(response) {

$scope.users = response.data;

});



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.