-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path20.isolated-scope-in-directive.html
38 lines (33 loc) · 1.88 KB
/
20.isolated-scope-in-directive.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
<!DOCTYPE html>
<html>
<head>
<title>Isolated scope in directives</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script type="text/javascript" src="20.isolated-scope-in-directive.js"></script>
</head>
<body ng-app="app">
<div class="container" ng-controller="parent">
<h3>String value to be accesed(@)</h3>
Controller : a = {{a}}, b = {{b}}, c = {{p}}, d = {{q}}<hr/>
Directive1 Instance1<div message x="Hello" y="world"></div>
Directive1 Instance2<div message x="{{p}}" y="{{q}}"></div>
Directive1 Instance3<div message x="{{p * 10}}" y="{{q * 2}}"></div><br><br>
Directive2 Instance1<div message2 m="{{a}}" n="{{b}}"></div>
<h3>Object to be accesed(=)</h3>
Controller : empno = {{emp.empno}}, name = {{emp.name}}
Ename : <input type="text" ng-model="emp.name"><hr/>
Directive1 Instance1<div message-obj employee="emp"></div><br>
Directive1 Instance2<div message-obj employee="emp2"></div><br><br>
Directive2 Instance1<div message-obj2 o-emp="emp2"></div><br>
<h3>Function to be accesed(&)</h3>
Controller : x = {{x}}, y = {{y}}<br>
<button ng-click="doSum(x, y)">Sum</button><hr/>
<!-- Directive1 Instance1<div message-fun ext-sum="doSum"></div><br> -->
<!-- Directive1 Instance2<div message-fun ext-sum="doSum(m,n)"></div><br> -->
Directive1 Instance2<div message-fun just-sum="doSum(m,n)"></div><br>
</div>
</body>
</html>