Skip to content

Commit

Permalink
fix(md-tooltip): update tooltip when tooltip text change
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullfis committed Sep 21, 2016
1 parent 771702f commit 1b23a8d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,24 @@ export class MdTooltip {
attached() {
this.attributeManager.addClasses('tooltipped');
this.attributeManager.addAttributes({ 'data-position': this.position, 'data-tooltip': this.text });
$(this.element).tooltip({
delay: parseInt(this.delay, 10),
html: this.html
});
this.initTooltip();
}
detached() {
$(this.element).tooltip('remove');
this.attributeManager.removeClasses('tooltipped');
this.attributeManager.removeAttributes(['data-position', 'data-tooltip']);
}
textChanged() {
this.attributeManager.addAttributes({ 'data-tooltip': this.text });
this.initTooltip();
}

initTooltip() {
$(this.element).tooltip({
delay: parseInt(this.delay, 10),
html: this.html
});
}
}

0 comments on commit 1b23a8d

Please sign in to comment.