-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular.html
More file actions
63 lines (51 loc) · 1.9 KB
/
angular.html
File metadata and controls
63 lines (51 loc) · 1.9 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
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Angular App Using Vue.js Component</title>
<script src="https://unpkg.com/vue"></script>
<script src="dist/sampleComponents.js"></script>
<script src="http://code.angularjs.org/snapshot/angular.js"></script>
<script src="dist/sampleComponentsAngular.js"></script>
</head>
<body>
<h1 class="title">AngularJS and Vue.js</h1>
<p>View console log to see events</p>
<!-- This demonstrates using Vue.js in ths same page as Angular.js -->
<div id="vue-app">
<h2>Vue.js Only Section</h2>
<hello-component name="World"></hello-component>
<hello2-component name="Everyone"></hello2-component>
</div>
<!-- Angular "app" using Angular directive elements that wrap Vue.js coomponents -->
<div ng-app="MainModule">
<div ng-controller="Controller">
<h2>AngularJS App Section</h2>
<p>AngularJS elements wrapping Vue.js Components</p>
<simple-counter-wrapper initial-count="count1"></simple-counter-wrapper>
<br>
<simple-counter-wrapper initial-count="count2"></simple-counter-wrapper>
<br>
<simple-contact-wrapper initial-contact="mike"></simple-contact-wrapper>
<br>
<simple-contact-wrapper initial-contact="mark"></simple-contact-wrapper>
</div>
</div>
<script>
// Start Vue for the "only" Vue part
new Vue({
el : '#vue-app'
});
// best practice would be to put this in another file
angular.module('MainModule', ['componentWrappers'])
.controller('Controller', ['$scope', function ($scope) {
$scope.count1 = 10;
$scope.count2 = 20;
$scope.mike = {name: 'Mike', phone: '555-0001'};
$scope.mark = {name: 'Mark', phone: '555-0002'};
}]);
// Instead of using ng-app above, it is possible to bootstrap Angular
// "manually" using this:
// angular.bootstrap(document.body, ['MainModule']);
</script>
</body>