This repository was archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathapp.js
More file actions
127 lines (115 loc) · 3.85 KB
/
app.js
File metadata and controls
127 lines (115 loc) · 3.85 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
var app = angular.module('myApp', ['angular-intro']);
app.controller('MyController', function ($scope,ngIntroService) {
$scope.IntroOptions = {
steps:[
{
element: document.querySelector('#step1'),
intro: "This is the first tooltip."
},
{
element: document.querySelectorAll('#step2')[0],
intro: "<strong>You</strong> can also <em>include</em> HTML",
position: 'right'
},
{
element: '#step3',
intro: 'More features, more fun.',
position: 'left'
},
{
element: '#step4',
intro: "Another step.",
position: 'bottom'
},
{
element: '#step5',
intro: 'Get it, use it.'
}
],
showStepNumbers: false,
showBullets: false,
exitOnOverlayClick: true,
exitOnEsc:true,
nextLabel: 'next',
prevLabel: '<span style="color:green">Previous</span>',
skipLabel: 'Exit',
doneLabel: 'Thanks'
};
$scope.CompletedEvent = function(){
console.log('[directive] completed Event')
}
$scope.ExitEvent= function(){
console.log('[directive] exit Event')
}
$scope.ChangeEvent = function(){
console.log('[directive] change Event')
}
$scope.BeforeChangeEvent= function(){
console.log('[directive] beforeChange Event')
}
$scope.AfterChangeEvent= function(){
console.log('[directive] after change Event')
}
$scope.clearAndStartNewIntro = function(){
$scope.IntroOptions = {
steps:[
{
element: document.querySelector('#step1'),
intro: "After being cleared, step 1"
},
{
element: '#step2',
intro: 'Setup and details :)',
position: 'right'
},
{
element: '.jumbotron',
intro: 'We added a small feature, adding <pre>ng-intro-disable-button</pre> your buttons will be disabled when introJs is open :) <br><p style="color:red">if you\'re using anchor tags, you should prevent ng-click manually. </p> <p> <a target="_blank" href="https://github.com/mendhak/angular-intro.js/wiki/How-to-prevent-a-ng-click-event-when-a-tag--a--is-disabled%3F">click here for more details.</a></p>'
}
],
showStepNumbers: true,
showBullets: true,
exitOnOverlayClick: false,
exitOnEsc:false,
nextLabel: '<strong style="color:green">Next!</strong>',
prevLabel: '<span style="color:red">Previous</span>',
skipLabel: 'Skip',
doneLabel: 'Done'
};
ngIntroService.clear();
ngIntroService.setOptions($scope.IntroOptions);
ngIntroService.onComplete(function(){
console.log('update some cookie or localstorage.')
})
ngIntroService.onExit(function(){
console.log("[service] exit");
})
ngIntroService.onBeforeChange(function(){
console.log("[service] before change");
})
ngIntroService.onChange(()=>{
console.log("[service] on change");
})
ngIntroService.onAfterChange(()=>{
console.log("[service] after Change");
})
ngIntroService.start();
}
}).directive('ngClick', function () {
return {
restrict: 'A',
priority: 1,
terminal: true,
link: function (scope, element, attr) {
var clickAction = attr.ngClick; // get the current ngclick value
var d = element.bind('click',function () {
if (attr.disabled==undefined) {//check if the tag is available to be clicked
scope.$eval(clickAction) // call the event
}
});
scope.$on('$destroy', function(){
d(); // destroy the bind we created, so it a memory leak is prevented.
})
}
};
});