<!DOCTYPE html>
<html data-ng-app="serviceModule">
<head>
<meta charset="ISO-8859-1">
<title>AngularJS GET Spring MVC Through Service Controller</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script type="text/javascript">
 
	var serviceModule = angular.module('serviceModule', []);
	
	serviceModule.controller('LoadFileController', function($scope, sampleService) {
		
		$scope.variable = "AngularJS GET Spring MVC Through Service Controller";
	    
		sampleService.getDataSeriveExample().then(function(response){
	        $scope.environment = response.data;
	        console.log($scope.environment);
	    });
		
	});
	
	serviceModule.service('sampleService', function($http) {
		
		this.getDataSeriveExample = function() {
		    var promise = $http.get('getService').success(function(data, status, headers, config) {
		    	return data;
		    });
 
		    return promise; 
		};
		
	});
	
</script>
</head>
<body data-ng-controller="LoadFileController"> 
	
	<div>
		<h2>{{variable}}</h2>
		<p>Response:  {{environment}}</p>		
	</div>
 
</body>
</html>