-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular.html
More file actions
38 lines (35 loc) · 1.46 KB
/
angular.html
File metadata and controls
38 lines (35 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<title>jQuery AJAX</title>
<meta charset="utf-8" />
<style>
body { font-family: sans-serif; font-size: 1.2em; }
form { padding: 1.5em; }
label { display: block; margin-bottom: .25em; }
input { width: 17em; margin-bottom: 1.75em; border: 2px solid #E1E1E1; border-radius: 3px; padding: .75em 1em; }
button { display: block; padding: .5em .75em; border: 2px solid #A269C1; border-radius: 3px; background-color: #fff; cursor: pointer; }
</style>
</head>
<body ng-app="example">
<form ng-controller="login_controller">
<label for="username">Username</label><input id="username" ng-model="user.name" />
<label for="password">Password</label><input type="password" id="password" ng-model="user.password" />
<button type="submit" ng-click="submit_user()">Login</button>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script>
(function () {
'use strict';
angular.module('example', []).controller('login_controller', ['$scope', '$http', function ($scope, $http) {
$scope.user = {};
$scope.submit_user = function () {
$http.post('/signin', $scope.user).then(function (response) {
console.log(response);
});
};
}]);
}());
</script>
</body>
</html>