-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.html
28 lines (28 loc) · 856 Bytes
/
index.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
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8" />
<title>Chapter1 Example5</title>
<script src="http://code.angularjs.org/1.2.14/angular.js"></script>
</head>
<body ng-controller="ExampleController">
<h1>Introduction</h1>
<label>My name:</label>
<input type="text" placeholder="Please enter name" ng-model="name" ng-focus="onNameFocused()">
<h3 ng-show="name">Hello! My name is {{name}}.</h3>
<div ng-show="previousName">Previous name was {{previousName}}.</div>
<script>
;(function(){
var myAppModule = angular.module('myApp', []);
myAppModule.controller('ExampleController', function ($scope) {
$scope.name = "Alex Pop";
$scope.previousName = "";
$scope.onNameFocused = function() {
$scope.previousName = $scope.name;
};
});
}());
console.log(myAppModule.name);
</script>
</body>
</html>