Created
February 10, 2014 02:30
HelloWorldSpring4View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jshint unused: false */ | |
/*global angular:true */ | |
// Declare app level module | |
var App = angular.module('App', []); | |
(function() { | |
'use strict'; | |
App.controller("HelloCtrl", ['$scope', '$http', | |
function($scope, $http) { | |
$scope.name = "User"; | |
$scope.message = ""; | |
$scope.getName = function() { | |
$http.get('hello/' + $scope.name).then(function(response) { | |
$scope.message = "Hello " + response.data; | |
}); | |
}; | |
} | |
]); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="App"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Hello</title> | |
</head> | |
<body ng-controller="HelloCtrl"> | |
<input type="text" ng-model="name"></input><button ng-click="getName()">Submit</button> | |
<div>{{message}}</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.js"></script> | |
<script src="js/app.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment