yalabot / angular-foundation

http://pineconellc.github.io/angular-foundation/
Other
1.05k stars 266 forks source link

trigger tour in controller #278

Closed ryankc33 closed 9 years ago

ryankc33 commented 9 years ago

How do you trigger $tour.start with a controller scope? I need to do something like the following coffeescript:

if !$scope.is_setup
    $tour.start

I've tried several variations including:

$scope.start = $tour.start
if !$scope.is_setup
    $scope.start = true

and setting a step-trigger on the element

<div ....step-trigger="start">hello</div> 

if !$scope.is_setup
    $scope.start = true

But nothing seems to work. It only works by manually clicking a button:

<button ng-click="start()">Button</button>
$scope.start = $tour.start
ryankc33 commented 9 years ago

For some reason calling $tour.start in the controller doesn't work. I had to extend the setCurrentStep function to trigger $tour in the controller:

this.startTour = function () {
    currentIndex = 1;
    storeCurrentStep();
}

controller:

if !$scope.is_setup
    $tour.startTour