abhikmitra / ng-joyride

Angular Joyride Directive for creating custom introductions to websites
126 stars 68 forks source link

"Don't show again" button #19

Open Maidomax opened 9 years ago

Maidomax commented 9 years ago

This is either a feature request or a request for assistance. I'm trying to add a "Don't show again" button to individual tooltips that would prevent them from being shown in the future. I tried to accomplish this by by adding an <input type="checkbox" name="tour_tooltip_1" id="tour_tooltip_1" ng-model="tooltip_1_dismissed"> to the text of each tooltip, and the checkbox renders correctly, but doesn't have access to any scopes, including $rootScope. The model doesn't get bound to anything, I can't output any values with (( myValue }} inside the tooltip. The tooltip content seems completely outside of my Angular app's scope. Is there any way I can accomplish what I need done?

Thanks!

afloyd commented 9 years ago

:+1:

afloyd commented 9 years ago

I didn't do a "full" implementation as it should be... But I forked the code and added a disable checkbox to the modals.

When instantiating the ng-joyride directive you should put a dont-show-fn attribute (ie <ng-joyride dont-show-fn="myFunc()" />) in there that references a function you want to run when the checkbox is checked and the user clicks skip or finish while on the joyride.

In my case I added a "hideJoyride" value to my user object and my dontShowFn then sets that value to true so on future visits I never enable the joyride...

A possible enhancement to what I did is if a dontShowFn is not passed in, and they click the disabled checkbox then it will update a browser cookie to not show on future visits. Hope it helps someone else looking for this.

I didn't issue a pull request since it's not fully implemented for all use cases, and you cannot selectively show/hide the checkbox through configuration. But hopefully it helps someone else that needs this

Cheers, Austin

https://github.com/afloyd/ng-joyride through bower use: "ng-joyride-af": "0.1.12"