forked from thelgevold/angular-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade.html
87 lines (66 loc) · 3.45 KB
/
upgrade.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script>
<link href="site.css?v=1" rel="stylesheet">
<link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<script>
System.config({
defaultJSExtensions: true
});
</script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/zone.js/dist/zone.min.js"></script>
<script src="node_modules/zone.js/dist/long-stack-trace-zone.min.js"></script>
<script src="https://code.angularjs.org/1.4.7/angular.min.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/upgrade.min.js"></script>
<script>
angular.module('angular-legacy',[]);
angular.module('angular-legacy').controller('testController', function(){
this.message = 'Angular 1.x integrating with Angular 2.0 components';
this.operands = {op1:10,op2:20};
this.value = {current:100, previous:null};
this.increment = function(){
this.operands.op1 += 1;
this.operands.op2 += 1;
};
});
</script>
</head>
<body>
<script>System.import('upgrade');</script>
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div>
<ul class="nav navbar-nav">
<li><a href="http://www.syntaxsuccess.com" class="link">Home</a></li>
<li><a href="/angular-2-samples" class="link">About</a></li>
<li><a href="/angular-2-samples/#/demo/spreadsheet" class="link">Demos</a></li>
<li><a href="/angular-2-samples/#/lazy" class="link">Lazy Loaded</a></li>
<li><a href="components/web-workers/web-worker-demo.html" class="link">Web Workers</a></li>
<li class="active"><a href="upgrade.html" class="link">Angular 2.0 inside Angular 1.x</a></li>
</ul>
</div>
</div>
</nav>
<h4><a href="http://www.syntaxsuccess.com/viewarticle/upgrading-angular-1.x-to-2.0">Read more here</a></h4>
<div ng-controller="testController as testController">
<h1>{{testController.message}}</h1>
<div class="alert alert-info" role="alert">Passing data to Angular 2.0 component</div>
<span>{{testController.operands.op1}} + {{testController.operands.op2}} = </span>
<add [operands]="testController.operands"></add>
<button ng-click="testController.increment()">Increment and Add</button>
<div style="margin-top: 30px;">
<div class="alert alert-info" role="alert">Getting changes back from Angular 2.0 component</div>
<counter-button [value]="testController.value"></counter-button>
<span>The current value is <strong>{{testController.value.current}}.</strong></span>
<span>The previous value is <strong>{{testController.value.previous}}.</strong></span>
</div>
<div style="margin-top: 30px;" class="alert alert-info" role="alert">Including independent Angular 2.0 components</div>
<algorithms></algorithms>
</div>
</div>
</body>
</html>