forked from im4aLL/Angular-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17.form.html
More file actions
59 lines (45 loc) · 1.12 KB
/
17.form.html
File metadata and controls
59 lines (45 loc) · 1.12 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
<link rel="stylesheet" href="src/doc.css">
<style type="text/css">
input.ng-invalid.ng-touched {
background-color: #FA787E;
}
input.ng-valid.ng-touched {
background-color: #78FA89;
}
</style>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="formModule">
<form action="" novalidate>
<label for="cname">Company name:</label>
<input type="text" id="cname" ng-model="frm.companyName" required>
<label for="location">Location:</label>
<input type="text" id="location" ng-model="frm.location" required>
<button type="submit" ng-click="save(frm)">SAVE</button>
</form>
<h4>From data</h4>
{{frm}}
<h4>Saved data</h4>
{{masterData}}
</div>
</div>
<script src="src/angular.1.3.min.js"></script>
<script>
var myApp = angular.module('myApp', []);
myApp.controller('formModule', ['$scope', function($scope) {
$scope.masterData = {};
$scope.save = function(frm){
$scope.masterData = angular.copy(frm);
//$scope.masterData = frm;
console.log( $scope.masterData );
};
}]);
</script>
</body>
</html>