-
Notifications
You must be signed in to change notification settings - Fork 453
/
login.html
73 lines (71 loc) · 2.28 KB
/
login.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>Login Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js"></script>
<style>
.container {
width: 300px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form-group {
margin-bottom: 10px;
}
.form-group label {
display: block;
font-weight: bold;
}
.form-group input {
width: 100%;
padding: 5px;
border: 1px solid #ccc;
border-radius: 3px;
}
.form-group button {
width: 100%;
padding: 8px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 3px;
cursor: pointer;
}
</style>
</head>
<body ng-controller="LoginController">
<div class="container">
<h2>Login</h2>
<form>
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" ng-model="username" ng-init="username='Raghav'" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" ng-model="password" ng-init="password='Hello'" required>
</div>
<div class="form-group">
<button type="submit" ng-click="login()">Login</button>
</div>
</form>
</div>
<script>
angular.module('myApp', [])
.controller('LoginController', function($scope, $http) {
$scope.username = 'Raghav';
$scope.password = 'Hello';
$scope.login = function() {
$http.post('http://localhost:3000/login', {
username: $scope.username,
password: $scope.password
}).then(function(response) {
window.location.href = 'home.html';
});
};
});
</script>
</body>
</html>