Skip to content

Commit a95bcf1

Browse files
committed
use of any selector instead of just ID
1 parent 2299ad5 commit a95bcf1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

app/tour-controller.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,16 @@ export default function uiTourController($timeout, $q, $filter, $document, TourC
261261

262262
await handleEvent(step.config('onShow'));
263263

264-
if (!step.element && step.elementId) {
265-
step.element = angular.element($document[0].getElementById(step.elementId));
264+
if (!step.element) {
265+
if (step.elementId) {
266+
step.element = angular.element($document[0].getElementById(step.elementId));
267+
}
268+
if (step.selector) {
269+
step.element = angular.element($document[0].querySelector(step.selector));
270+
}
266271

267272
if (!step.element) {
268-
throw `No element with ID '${step.elementId}' exists.`;
273+
throw `No element found for step: '${step}'.`;
269274
}
270275
}
271276

app/tour-step-service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export default function (Tether, $compile, $document, $templateCache, $rootScope
6464
* @returns {*} configured step
6565
*/
6666
service.createStep = function (step, tour) {
67-
if (!step.element && !step.elementId) {
67+
if (!step.element && !step.elementId && !step.selector) {
6868
throw {
6969
name: 'PropertyMissingError',
70-
message: 'Steps require an element or element ID to be specified'
70+
message: 'Steps require an element, ID, or selector to be specified'
7171
};
7272
}
7373

0 commit comments

Comments
 (0)