Giter Club home page Giter Club logo

Comments (5)

benmarch avatar benmarch commented on May 27, 2024

Check to see if $scope.tour is available, if your controller is declared outside of the tour declaration then it will not be available. In the initTour function wrap everything with if ($scope.tour) { ... }.

If that isn't the issue, try using tour.restart(true) or maybe even tour.start(true) to force it to start.

from angular-bootstrap-tour.

benmarch avatar benmarch commented on May 27, 2024

Any update @vvillasoto?

from angular-bootstrap-tour.

vvillasoto avatar vvillasoto commented on May 27, 2024

@benmarch I am able to make it work but not by using $scope.tour. This will not be found. I inspected it and found that the tour object is attached to any one of the step elements / or just the container element wherein all the steps can be found within the html. I used angular.element to access it from the controller.

$scope.initTour = function() {
    // if you like to do any modification in the tour object
    angular.element( "#section1" ).scope().tour._options.template = 
            "<div class='popover tour-xdkTour' role='tooltip'>" + "\n"
          + "<div class='arrow'></div>" + "\n" + "<h3 class='popover-title'></h3>" + "\n"
          + "<div class='popover-content'></div>" + "\n" + "<div class='popover-navigation'>" + "\n" 
          + "<div class='btn-group'>" + "\n"
          + "<button class='btn btn-default' data-role='prev'>« Prev</button>" + "\n"
          + "<button class='btn btn-default' data-role='next'>Next »</button>" + "\n" + "</div>"
          + "\n" + "<button class='btn btn-default' data-role='end'>Next Widget</button>" + "\n"
          + "</div>" + "\n" + "</div>";
   // next you can init and start the tour
   angular.element( "#section1" ).scope().tour.init();
   angular.element( "#section1" ).scope().tour.start();
}

$scope.init = function() {
    MyService.getData().then(
        function(data) {
              $scope.data = data;
              $timeout($scope.initTour(), 2000);
        }
}

var interval = $interval($scope.init, 60000);

$scope.$on('$destroy', function() {
      $interval.cancel(interval);
});

hope this helps. Let me know if you figure out a better solution.

Thanks.

from angular-bootstrap-tour.

benmarch avatar benmarch commented on May 27, 2024

It looks to me like this code is in a controller that is outside of the scope of the tour controller. If you can move this controller code inside of "#section1" then you would be able to access it via $scope.tour. You can also improve this by moving the template text into a template script tag and using the template-url attribute on the tour element.

from angular-bootstrap-tour.

vvillasoto avatar vvillasoto commented on May 27, 2024

Thanks for the advice. Will try to improve on it. I think this is resolved :)

from angular-bootstrap-tour.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.