Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement angular-tour on a angular web app

i'm trying to add a tour to a web app using the ng-tour plugin: http://daftmonk.github.io/angular-tour/ The example on the plugin home page is done on a single web page making it hard for me to figure out how to implement this on a angular web app. I added the following to my index.html:

my code:

adding the tour-step id to a view:

<div ui-view="portal" ng-show="$state.includes('portal')" id="e0"></div>

At the bottom of my index.html file:

<tour step="currentStep">
    <virtual-step tourtip="test " tourtip-element="#e0" tourtip-next-label="next" tourtip-placement="right" tourtip-step="0" ></virtual-step>

    </tour>
    </body>
</html>

Nothing happens when the app routes to the portal view... Should I add the ng-tour tag to the individual views HTML templates instead? I tried that initially but also couldn't make it work.

like image 775
user2094257 Avatar asked Aug 23 '16 12:08

user2094257


People also ask

How do I run an Angular project on shared hosting?

import { LocationStrategy, PathLocationStrategy } from '@angular/common'; Now execute ng build --prod once more and upload the new distribution files to your shared server — everything should now work! That is all you need to begin working with Angular on your very own shared hosting server.


1 Answers

If you don't initialize currentStep in your controller it will be by default set to -1, which mean the tour won't appear on page load. -Angular tour documentation

So make sure you initialize $scope.currentStep in your controller.

Regarding multiple views, the virtual steps section of the documentation says you can define all of your steps in one spot and just target elements in different views using tourtip-element="#element-from-another-view". Of course those views will have to be on the DOM when you get to that tip.

like image 172
adamdport Avatar answered Oct 10 '22 02:10

adamdport