如何在angular material 2中制作一个平面图标按钮?

How to make a flat icon button in angular material 2?

我想要一个与angular material documentation site相同的图标按钮。

您可以在下图中查看 查看源代码plunker 按钮。我不知道是否有任何指令。在文档中,他们显示了带有 md-fabmd-mini-fab 属性的图标。

我想要一个与下图中的 View source codePlunker 按钮相同的图标按钮。

使用 button 元素上的 md-icon-button 属性获取图标按钮:

<button md-icon-button mdTooltip="Check me">
    <md-icon>check</md-icon>
</button>

注意: 如果您使用 Material Icons by Google, make sure you import the stylesheet in your index.html or in your styles.css as material2 will not supply it by default. (You may alternatively use other icons such as SVG icons or CSS)

添加以下代码以将 Material 图标样式表导入您的 index.html(如上所述):

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

或通过CSS(在styles.css中):

@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

更多信息: