1

I have problem similar to Getting Highcharts tooltip to return an angular directive?. But I tried to create some complex tooltip using directive which has defined templateUrl instead using inline template. When I use templateUrl, html is loaded asynchronously and when I'm using it into tooltip formatter it is no loaded yet.

I need use html template because I need to define a tooltip which should have clickable navigation button to other site and prepared for one data series, also should be translated and styled.

1

1 Answer 1

1

When you call $compile with a directive with a templateUrl, the content isn't updated until a digest cycle runs.

Since you are within a jQuery event (outside Angular digest cycle) you need to manually trigger a $scope.$digest().

See forked Plunker & snippet below:

tooltip: {
    useHTML: true,
    pointFormatter: function () {
        var element = $compile('<chart-tooltip></chart-tooltip>')($scope);
        $scope.$digest();
        return element.html();
    }
}

(Also added missing useHTML: true)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.