简体   繁体   English

在md-button上应用图标样式

[英]Apply icon styling on md-button

I am using ng2-material library (built on top of angular2). 我正在使用ng2-material库 (基于angular2构建)。 The documentation and demos are clearly out dated and not updated as per the new angular 2 release. 文档和演示显然已经过时,并且没有按照新的angular 2版本进行更新。 However, having made the necessary adjustments so far, I want a menu icon inside a button which is located on the toolbar of the page. 但是,到目前为止,已经进行了必要的调整,我想要位于页面工具栏上的按钮内的菜单图标。 I am able to load the material icon of menu, but still cannot give it a button-icon styling. 我可以加载菜单的材质图标,但是仍然不能给它一个button-icon样式。 This is how I am doing it: 这就是我的做法:

<button md-button class="md-icon-button" aria-label="Settings">
  <i class="mdclass-dark material-icons" md-icon >menu</i>
</button>

This is giving the menu icon the styling, that of a button, rather than that of an md-icon.. Can someone please let me know how to do that? 这使菜单图标具有样式,按钮的样式,而不是md图标的样式。.有人可以让我知道该怎么做吗?

use md-icon-button directive instead of md-button . 使用md-icon-button指令而不是md-button

and you can also use <md-icon> element instead of <i> to display material icons. 您还可以使用<md-icon>元素代替<i>来显示材质图标。

<button md-icon-button aria-label="Settings">
  <md-icon>menu</md-icon>
</button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM