Consuming a Rest Web Service Example - AngularJS Client

This example explains how to implement a rest client using AngularJS. Before running this application, please make sure a Rest Web Service is running in your machine and it should be available at

Please refer Rest Web Services - Apache CXF for a rest Web Service example.

Following html document can run its own or you can place it inside a server.

Create AngularJS Rest Client

<!DOCTYPE html>
<html lang="en">
<script src=""></script>
<div ng-app="myApp" ng-controller="formCtrl">
	<form name="myForm">
		<button ng-click="submit()">Get Address</button>
		<td>{{ address.streetAddress }}</td>
		<td>{{ address.addressOptional }}</td>
		<td>{{ }}</td>
		<td>{{ address.state }}</td>
		<td>{{ }}</td>
		<td>{{ }}</td>



	var app = angular.module('myApp', []);
	app.controller('formCtrl',function($scope, $http) {
	$scope.reset = function() {
	$scope.user = angular.copy($scope.master);
	$scope.submit = function() {
	   method : 'GET',url : 'http://localhost:8080/apache_cxf_rest_ws/services/system/v1/address',
	   headers : {
		'Accept' : 'application/json'
	   function(data, status, headers,config) {
		$scope.address = data;
	function(data, status, headers,config) {});