benmarch / angular-bootstrap-tour

AngularJS wrapper around Bootstrap Tour
64 stars 27 forks source link

A tour-step does not put itself on scope #23

Closed bartvanderwal closed 9 years ago

bartvanderwal commented 9 years ago

Hi! Great project! Very helpful.

A thing I'm missing is that the tour-step directive doesn't put 'itself' on the scope in the link function. You ARE doing this in the tour directive (see [ln 47]([tour directive]%28https://github.com/benmarch/angular-bootstrap-tour/blob/master/app/tour_directive.js%29)):

    //Initialize tour
    templateReady.then(function () {
        scope.tour = ctrl.init(tour); /// <- this line
        scope.tour.refresh = ctrl.refreshTour;
    });

Could you add a similar thing in the tour_step? (e.g. here on line 94)

    //Add step to tour
    templateReady.then(function () {
        scope.step = step;  // <-- Please add this line here!!
        ctrl.addStep(step);
    });

I understand that this is not needed by your code. But that gives me a hook to extend your directive with another custom directive. I could also clone your project and do a PR if you prefer that! Let me know.

Background: I'm working an extension. I'm using your directives as much as possible, but extended them with two custom ones so all things like 'title', 'content', et.c can also be set in one single place in a config object. That way we don't have to put them within the HTML directly. That would litter the views in our project with a lot of code. Furthermore the config could then also be retreived and saves in the backend, for instance to allow dynamic customization per user.

Connecting the tour steps to certain places in the DOM/view is still done with your 'tourandtour-step` directives. But only a name needs to be specified to make the connection to the stuff in config.

benmarch commented 9 years ago

Sounds pretty cool, I'd like to check it out when it's done (if it's open sourced). I don't see how it could hurt to add the step to the scope, but I would appreciate a PR since I don't know when I will be able to get to it. It can definitely be in the Angular-UI version.

bartvanderwal commented 9 years ago

Hey @benmarch, I did a pull request. Can you see it? :)

Pull and close this issue?

benmarch commented 9 years ago

Hey Bart, sorry for the delay, I did see it but I was away on vacation and couldn't review it. I'll take a look now and comment in the PR.

benmarch commented 9 years ago

Merged PR #25 and released 0.3.3