Monday, 24 April 2017

AngularJS-21 : Webservice call


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

AngularJS-24 : Router

AngularJS-24 : Router https://www.youtube.com/watch?v=hThmoKA9aeU#t=427.383649 Download "angular-route.min.js"and add to p...