AngularJS-21 : Webservice call
angular.min.js
-------------------------------------
Script.js
------------------------------------
/// <reference path="angular.min.js" />
var myAppModule = angular.module("myAppModule",[]).
controller("myDataController",function ($scope,$http,$log) {
$http({
method: 'GET',
url: 'EmployeeServicePort'}) //url: 'resources/GenericResource'
.then(function (response) {
$scope.city = response.data;
$log.info(response);
},
function (reason) {
$scope.error = reason
});
});
myHTML.html
---------------------------------------
<!DOCTYPE html>
<html ng-app="myAppModule">
<head>
<script type="text/javascript" src="resources/js/angular.min.js"></script>
<script type="text/javascript" src="resources/js/Script.js"></script>
<link type="text/css" rel="stylesheet" href="resources/myCSS.css"/>
</head>
<body ng-controller="myDataController">
<div>
Response data : {{ city }}
</div>
</table>
</body>
</html>
No comments:
Post a Comment