Skip to content

Commit 4835b33

Browse files
committed
regenerated dist
1 parent 03c2778 commit 4835b33

File tree

3 files changed

+64
-7
lines changed

3 files changed

+64
-7
lines changed

app/angular-bootstrap-tour.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
$compile($template)(scope);
9494
});
9595
return $template;
96-
}
96+
};
9797

9898
};
9999

@@ -299,7 +299,7 @@
299299
}
300300

301301
if (template) {
302-
options.template = template;
302+
step.template = template;
303303
}
304304

305305
function stepIsSkipped() {

dist/angular-bootstrap-tour.js

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,38 @@
8282

8383
}
8484

85+
app.factory('TourTemplateFactory', ['$templateCache', '$compile', function ($templateCache, $compile) {
86+
87+
var templateFactory = {};
88+
89+
templateFactory.wrap = function (template, scope) {
90+
return function (/*index, step*/) {
91+
var $template = angular.element(template); //requires jQuery
92+
safeApply(scope, function () {
93+
$compile($template)(scope);
94+
});
95+
return $template;
96+
};
97+
98+
};
99+
100+
templateFactory.get = function (templateUrl, scope) {
101+
102+
var template = $templateCache.get(templateUrl);
103+
104+
if (template) {
105+
return templateFactory.wrap(template, scope);
106+
}
107+
108+
return null;
109+
110+
};
111+
112+
113+
return templateFactory;
114+
115+
}]);
116+
85117
app.controller('TourController', ['$filter', function ($filter) {
86118

87119
var self = this,
@@ -137,7 +169,7 @@
137169

138170
}]);
139171

140-
app.directive('tour', [function () {
172+
app.directive('tour', ['TourTemplateFactory', function (TourTemplateFactory) {
141173

142174
return {
143175
restrict: 'EA',
@@ -157,7 +189,8 @@
157189
placement: attrs.placement || 'right',
158190
backdrop: attrs.backdrop || false,
159191
orphan: attrs.orphan || false
160-
};
192+
},
193+
template;
161194

162195
attachEventHandlers(scope, attrs, options);
163196

@@ -197,6 +230,18 @@
197230
};
198231
}
199232

233+
if (attrs.template) {
234+
template = TourTemplateFactory.wrap(scope.$eval(attrs.template), scope);
235+
}
236+
237+
if (attrs.templateUrl) {
238+
template = TourTemplateFactory.get(attrs.templateUrl, scope);
239+
}
240+
241+
if (template) {
242+
options.template = template;
243+
}
244+
200245
scope.$watchCollection(ctrl.getSteps, function (steps) {
201246
scope.stepCount = steps.length;
202247
});
@@ -212,7 +257,7 @@
212257

213258
}]);
214259

215-
app.directive('tourStep', [function () {
260+
app.directive('tourStep', ['TourTemplateFactory', function (TourTemplateFactory) {
216261

217262
return {
218263
restrict: 'EA',
@@ -223,7 +268,8 @@
223268
var step = {
224269
element: element,
225270
order: attrs.order || 0
226-
};
271+
},
272+
template;
227273

228274
if (attrs.path) { step.path = attrs.path; }
229275
if (attrs.animation) { step.animation = attrs.animation; }
@@ -244,6 +290,17 @@
244290
step.content = title;
245291
});
246292

293+
if (attrs.template) {
294+
template = TourTemplateFactory.wrap(scope.$eval(attrs.template), scope);
295+
}
296+
297+
if (attrs.templateUrl) {
298+
template = TourTemplateFactory.get(attrs.templateUrl, scope);
299+
}
300+
301+
if (template) {
302+
step.template = template;
303+
}
247304

248305
function stepIsSkipped() {
249306
if (attrs.skip) {

dist/angular-bootstrap-tour.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)