Angular 如何在';在'之后的下方;像matBadge
我想在另一个类似matBadge样式的按钮的角落中显示mat mini fab按钮 例如: 我之所以不简单地使用matBadge,是因为我希望它可以单击Angular 如何在';在'之后的下方;像matBadge,angular,angular-material,Angular,Angular Material,我想在另一个类似matBadge样式的按钮的角落中显示mat mini fab按钮 例如: 我之所以不简单地使用matBadge,是因为我希望它可以单击 就像一个按钮 如果有一种方法可以使matBadge可单击并运行带有(单击)属性的函数,那么这也是一个不错的选择您只想在值之前添加“+”吗? 为什么不将示例中的第二个按钮与值前的“+”一起使用,例如: <button mat-raised-button color="primary" matBadge=&qu
就像一个按钮 如果有一种方法可以使matBadge可单击并运行带有
(单击)
属性的函数,那么这也是一个不错的选择您只想在值之前添加“+”吗?
为什么不将示例中的第二个按钮与值前的“+”一起使用,例如:
<button mat-raised-button color="primary"
matBadge="+8" matBadgePosition="below after" matBadgeColor="accent">
Action
</button>
另外,如果您只想调用嵌套按钮方法(而不调用父按钮方法),则需要添加$event.stopPropagation()方法。例如:
(click)="onMatMiniFabClicked(); $event.stopPropagation()"
我编辑了我的问题。我需要通过点击mini fab按钮来激活一个功能。
<button mat-mini-fab color="accent" class="custom-mat-mini-fab"
aria-label="Example icon button with a plus one icon">
<mat-icon style="icon24" class="custom-mat-icon">
plus_one
</mat-icon>
</button>
.custom-mat-mini-fab {
position: absolute;
top: 25px;
left: 70px;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.custom-mat-icon {
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
}
(click)="onMatMiniFabClicked(); $event.stopPropagation()"