-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
87 lines (70 loc) · 2.48 KB
/
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
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 ng-app="myApp">
<header>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Plugin's stylesheet -->
<link rel="stylesheet" href="assets/owl.carousel.css">
</header>
<body style="padding: 10px;">
<h1>Welcome to ngMount Demo Page</h1>
<p>In this demo we are using <a href="http://owlgraphic.com/owlcarousel/">Owl Carousel</a> as a jQuery plugin example.</p>
<h3>How you were used to use a plugin in a non-Angular application</h3>
Your HTML:
<pre>
<div id="owl-example" class="owl-carousel">
<div> Your Content </div>div
<div> Your Content </div>div
<div> Your Content </div>div
<div> Your Content </div>div
<div> Your Content </div>div
<div> Your Content </div>div
<div> Your Content </div>div
...
</div>
</pre>
.. and in your js:
<pre>
$(document).ready(function() {
$("#owl-example").owlCarousel();
});
</pre>
<h3>How you can now use a plugin in your Angular application thanks to ngMount</h3>
Your HTML:
<pre>
<div ng-controller="myCtrl" class="owl-carousel" ng-mount="{plugin: 'owlCarousel', params:{items:4}}">
<div ng-repeat="c in contents"> {{c}} </div>
</div>
</pre>
.. and in your js (if needed):
<pre>
app.controller("myCtrl", function($scope) {
$scope.contents = ["Content 1", "Content 2", "Content 3", "Content 4", "Content 5", "Content 6"]
});
</pre>
<h2>See the plugin in action here:</h2>
<br>
<div ng-controller="myCtrl" style="margin-left:auto; margin-right: auto; width:60%" class="owl-carousel" ng-mount="{plugin: 'owlCarousel', params:{items:4}}">
<div ng-repeat="c in contents"> {{c}} </div>
</div>
<br>
<br>
<br>
<br>
<br>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<!-- Include js plugin -->
<script src="assets/owl.carousel.min.js"></script>
<!-- Include AngularJs -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<!-- Include ngMount -->
<script src="src/ng-mount.js"></script>
<!-- your app -->
<script>
var app = angular.module("myApp", ['ngMount']); //load module
app.controller("myCtrl", function($scope) {
$scope.contents = ["Content 1", "Content 2", "Content 3", "Content 4", "Content 5", "Content 6"]
});
</script>
</body>
</html>