diff --git a/README.md b/README.md
index a3173b1..120cc93 100644
--- a/README.md
+++ b/README.md
@@ -233,6 +233,7 @@ scope of the uiTour directive, and can be required as `TourController` in direct
| goTo() | Hides the current step and jumps to the provided one.
**Parameters:** _step_ Can be step object, step ID string, or step index
**Returns:** _Promise_ Resolved when provided step is shown, rejects if no step provided or found. |
| getStatus() | Returns the current status of the tour based on TourStatus enum.
**Parameters:** \
**Returns:** TourStatus (ON, OFF, PAUSED, WAITING). Usage example: after tour starts: `tour.getStatus() === tour.Status.ON; //true` |
| createStep() | Adds a step via a step configuration object.
**Parameters:** _step_ - a step config object: must contain an `element` (jQLite object) or `selector` (string) attribute. `selector` is resolved the first time a step is shown. |
+| destroyStep()| Remove a step from the tour as well as remove its popup from the DOM as well.
**Parameters:** _step_ - a step returned by `createStep()`. |
| reposition() | Forces the active step popover and backdrop (if visible) to reposition around the step target. This is useful when the size of the target changes dynamically after the step is activated. |
### `createStep()` Example
diff --git a/app/tour-controller.js b/app/tour-controller.js
index ea3a903..1ad78fe 100644
--- a/app/tour-controller.js
+++ b/app/tour-controller.js
@@ -579,6 +579,21 @@ export default function uiTourController($timeout, $q, $filter, $document, TourC
return step;
};
+ /**
+ * Destroy a step with destroying the created popup as well
+ *
+ * @protected
+ * @param step
+ */
+ self.destroyStep = function (step) {
+ var index = stepList.indexOf(step);
+
+ if (index !== -1) {
+ TourStepService.destroyPopup(stepList[index]);
+ self.removeStep(step);
+ }
+ };
+
/**
* returns a copy of the current step (copied to avoid breaking internal functions)
*
diff --git a/app/tour-step-service.js b/app/tour-step-service.js
index e3a06a3..214d2bc 100644
--- a/app/tour-step-service.js
+++ b/app/tour-step-service.js
@@ -56,7 +56,16 @@ export default function (Tether, $compile, $document, $templateCache, $rootScope
}
}
- /**
+ /**
+ * Destroy a step's popover
+ *
+ * @param {{}} step - Step options
+ */
+ service.destroyPopup = function (step) {
+ step.popup.remove();
+ };
+
+ /**
* Initializes a step from a config object
*
* @param {{}} step - Step options
diff --git a/dist/angular-ui-tour.js b/dist/angular-ui-tour.js
index c2d93f7..d6bf114 100644
--- a/dist/angular-ui-tour.js
+++ b/dist/angular-ui-tour.js
@@ -3275,12 +3275,21 @@ return /******/ (function(modules) { // webpackBootstrap
}
/**
- * Initializes a step from a config object
+ * Destroy a step's popover
*
* @param {{}} step - Step options
- * @param {{}} tour - The tour to which the step belongs
- * @returns {*} configured step
*/
+ service.destroyPopup = function (step) {
+ step.popup.remove();
+ };
+
+ /**
+ * Initializes a step from a config object
+ *
+ * @param {{}} step - Step options
+ * @param {{}} tour - The tour to which the step belongs
+ * @returns {*} configured step
+ */
service.createStep = function (step, tour) {
if (!step.element && !step.elementId && !step.selector) {
throw {
@@ -3997,6 +4006,21 @@ return /******/ (function(modules) { // webpackBootstrap
return step;
};
+ /**
+ * Destroy a step with destroying the created popup as well
+ *
+ * @protected
+ * @param step
+ */
+ self.destroyStep = function (step) {
+ var index = stepList.indexOf(step);
+
+ if (index !== -1) {
+ TourStepService.destroyPopup(stepList[index]);
+ self.removeStep(step);
+ }
+ };
+
/**
* returns a copy of the current step (copied to avoid breaking internal functions)
*