【问题标题】:Exclamation Mark on Input Angular Material输入角材料上的感叹号
【发布时间】:2020-10-13 21:02:06
【问题描述】:

输入无效时是否可以显示感叹号?

这样

我没有在 Angular Material 文档中找到这个。

【问题讨论】:

    标签: angular validation input angular-material


    【解决方案1】:

    你可以使用matsuffix,Prefix & Suffix in Angular Material

    <mat-form-field>
        <mat-hint>name</mat-hint>
        <mat-icon matSuffix><i class="fa fa-exclamation-circle" style="color: red;" aria-hidden="true"></i></mat-icon>
    // add logic when to display the exclamation circle
        <input matInput placeholder="enter name" required>
    </mat-form-field>
    

    我使用了 fontawesome 图标,但您可以添加您的图标或 css 样式的感叹号。 显然,您需要为何时显示错误添加逻辑。 祝你好运!

    【讨论】:

    • @AlexandreBueno 如果这是答案,请将其标记为这样。乐于助人!
    猜你喜欢
    • 2023-03-30
    • 1970-01-01
    • 2019-05-07
    • 2017-01-03
    • 2015-09-10
    • 2020-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多