我在我的应用程序中使用MatTooltipModule
<div class="input-group" matTooltipPosition="right"
matTooltip= "If you have multiple valve sizes this cost of ownership form needs to be completed for each size.">
<input class="form-control" type="number" [(ngModel)]="cons.valveNumber" [ngModelOptions]="{standalone: true}"/>
</div>
但是当我运行代码时,工具提示位于左侧而不是右侧。 为什么它出现在左边?
编辑:如果工具提示不适合右侧,matTooltipModule会自动将其移至左侧吗?如果确实如此,你怎么能把它留在右边?
答案 0 :(得分:2)
It's because you should use [matTooltipPosition]="'right'"
, don't forget brackets and pass a string (I guess that you mean right
as a string in your case, not a variable which keeps a string).
Here is a full list of tooltip positions:
"before"
"after"
"above"
"below"
"left"
"right"
I also suggest to take a look at "after"
position, may be it's what you are looking for.
答案 1 :(得分:0)
在你的 html 中使用它 位置="左"