{{}} 의 값은 model 이라고 할 수 있다.
$rootScope 는 모듈내의 어떤 곳이든 접근 할 수 있다.
{{}} 안에서는 수식으로 * 연산도 가능하다.
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
|
<!DOCTYPE html>
<html ng-app = "fruitApp">
<head>
</head>
<body>
<h1>{{name}}</h1>
<h1>{{age}}</h1>
<h1>{{age * m}}</h1>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<input type="text" ng-model="name">
<input type="text" value="{{name}}">
<script>
var module = angular.module('fruitApp',[]);
module.run(
function($rootScope){
$rootScope.name = "jteve";
$rootScope.age = "34";
$rootScope.m = "2";
}
);
</script>
</body>
</html>
| cs |
댓글 없음:
댓글 쓰기