benmarch / angular-ui-tour

Product tour using Angular UI Bootstrap Tooltips
163 stars 49 forks source link

adding caller controller function in tour-step-content #149

Open anupbelambe opened 7 years ago

anupbelambe commented 7 years ago

I am using the exact versions of the following:

I have installed this library via: (NPM, Bower, or downloaded package) NPM

I have observed the following behavior: While trying to set action button with action being controller function in tour-step-content, the controller action is not getting executed.

This is how I expected it to behave: The controller function is called if any action is provided in the content.

Here is my tour config, and all related step configs:

<div layout="row" flex ui-tour="abc" ui-tour-placement="bottom-left">

<div layout="row" tour-step="profile" tour-step-title="Title text!" tour-step-content="Now you can edit !<md-button ng-click="controller.funcA()">click for details</md-button>" tour-step-placement="top-left" tour-step-order="0">

Additional notes/code: In above case the step is shown correctly as expected but not able to get the controller function executed. This might be due to different scopes but is there any way to register callback which can be used in the step-content as additional action. Appreciate any workaround for the same.

benmarch commented 7 years ago

Hey @anupbelambe, do you want to call a method on your controller (i.e., the one controlling your step target) or the tour controller?

anupbelambe commented 7 years ago

@benmarch, want to call a method on controller (the one controlling your step target)

benmarch commented 7 years ago

Interesting, it looks like we lose reference to the enclosing scope once the popover is created so that won't work. I will look into adding that functionality in the next release.

You might be able to achieve this functionality by creating a custom template for this step though.