将工具提示添加到图标按钮

时间:2016-10-18 16:17:44

标签: angular angular2-forms angular-material2

我正在尝试将md工具提示添加到md-icon按钮,如下所示:

<div
    layout = 'row'
    layout-align = 'center center'>
  <button
      md-icon-button
      color = 'primary'
      (click) = 'resetInputForm()'>
    <md-icon class = 'md-24'>cached</md-icon>
    md-tooltip='Reset' tooltip-position='above'
  </button>
</div>

但是,图标工具提示的文字文本会显示在页面上而不是消息中,如下图所示:

感谢您的帮助。

enter image description here

1 个答案:

答案 0 :(得分:1)

您需要在按钮标记中添加工具提示作为atributte:

 <button
  md-icon-button
  color = 'primary'
  (click) = 'resetInputForm()'
  md-tooltip='Reset'
  tooltip-position='above'>
        <md-icon class = 'md-24'>cached</md-icon>
 </button>