GithubHelp home page GithubHelp logo

Comments (6)

rodrigovallades avatar rodrigovallades commented on May 24, 2024

Same question, anyone?

I imagine that the HTML has to be compiled before being injected, using $compile, but I can't make it work.

@ahmedhawas did you manage do solve this?

from angular-intro.js.

DURK avatar DURK commented on May 24, 2024

Same here. Does anyone know a workaround? I'd like to use a directive inside the template of a step.

from angular-intro.js.

DURK avatar DURK commented on May 24, 2024

@rodrigovallades @ahmedhawas I got it figured out using $compile!

First, define a callback on your ng-intro directive that's triggered when changing steps.

ng-intro-options="introOptions" ng-intro-onafterchange="onIntroAfterChange"

Second, configure the callback to compile the contents of the introjs-tooltip element. In my case, I've added a class 'compile' so I only compile the steps that need compiling.

$scope.onIntroAfterChange = function () {
    $timeout(function () {
        var el = angular.element('.introjs-tooltip');
        if (el.hasClass('compile')) {
            $compile(el.contents())($scope);
        }
    }, 500);
};

Note: even though it's triggered after a change, I needed a timeout to ensure the new step was rendered on the DOM.

Now you can add angular directives to the html of your steps, like an ng-click

{
    intro: '<button ng-click="onClick()">Click me</button>',
    tooltipClass : 'some-class compile'
}

Finally, the following method should be triggered!

$scope.onClick = function () {
    // great success!
}

from angular-intro.js.

rodrigovallades avatar rodrigovallades commented on May 24, 2024

Great, @DURK ! Thanks for the reply!

from angular-intro.js.

pavlokitdev avatar pavlokitdev commented on May 24, 2024

@DURK First of all - thanks for your solution.
I have one question: can we omit usage of $timeout for 500ms somehow?

from angular-intro.js.

DURK avatar DURK commented on May 24, 2024

I haven't figured that out yet. I'll look into that when I get the chance.

from angular-intro.js.

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.