Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom HTML in Tooltip not working #104

Open
hem19 opened this issue Sep 8, 2016 · 5 comments
Open

Custom HTML in Tooltip not working #104

hem19 opened this issue Sep 8, 2016 · 5 comments

Comments

@hem19
Copy link

hem19 commented Sep 8, 2016

I tried to put custom html inside materialize tooltip, but instead it is showing full text of the data-tooltip . Here is my code:
<img id="imgInSiteLogo" materialize="tooltip" class="left img-responsive tooltipped" src="Images/InsiteLogo.png" data-position="right" data-delay="50" data-html="true" data-tooltip="<div><h4>Hello</h4><h5>World</h5></div>">

I tried binding it to variable like this:
<img id="imgInSiteLogo" materialize="tooltip" class="left img-responsive tooltipped" src="Images/InsiteLogo.png" data-position="right" data-delay="50" data-html="true" [attr.data-tooltip]="message">
where 'message' is variable on the typescript value whose value is as follows:
message="<div><h4>Hello</h4><h5>World</h5></div>"

Both cases are not working for me. Here is one example to write custom html inside tooltip using jquery - https://fiddle.jshell.net/hcy8btaa/1/

I want to achieve same functionality in angular 2 without using jquery.

@rubyboy
Copy link
Contributor

rubyboy commented Oct 2, 2016

@hem19 is that something that MaterializeCSS supports?
If you provide an example of how you'd do that with vanilla MaterializeCSS I could try figuring out a way to support that with angular2-materialize.

@hem19
Copy link
Author

hem19 commented Oct 4, 2016

@rubyboy yes MaterializeCSS supports this feature since 0.97.7 version. But I suppose it's the issue with there library only as mentioned in this issue - Dogfalo/materialize#3495

I guess the issue is not about supporting custom HTML, it has something to do with data-tooltip value not getting updated when variable's value is updating. Even though in DOM it shows the new value of data-tooltip but on hovering it only shows empty black rectangle.

When I updated to 0.97.7 and gave custom HTML in data-tooltip itself, it works. For e.g, the below code shows Hello world with h4 and h5 class applied and with a line break between them.
<img id="imgInSiteLogo" materialize="tooltip" class="left img-responsive tooltipped" src="Images/InsiteLogo.png" data-position="right" data-delay="50" data-html="true" data-tooltip="<div><h4>Hello</h4><br/><h5>World</h5></div>">

But when I bind data-tooltip with a variable 'message' like this, it doesn't work. On hovering the image I am only getting empty black rectangle.
<img id="imgInSiteLogo" materialize="tooltip" class="left img-responsive tooltipped" src="Images/InsiteLogo.png" data-position="right" data-delay="50" data-html="true" [attr.data-tooltip]="message">

where 'message' is variable on the TS file whose value is as follows:
message="<div><h4>Hello</h4><br/><h5>World</h5></div>"

@Kaisle
Copy link

Kaisle commented Oct 21, 2016

Can confirm. data-tooltip attribute gets updated with the right value but the text inside the black tooltip box does not update.

@rubyboy
Copy link
Contributor

rubyboy commented Apr 30, 2017

Dogfalo/materialize#1537

@kjakub
Copy link

kjakub commented Nov 30, 2017

Please, what is the status of this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants