问题标签 [mat-error]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
angular - Mat 错误未显示自定义验证器的错误,但模板显示错误
app.component.html
app.component.ts
...
我正在尝试自定义验证器。html 表单 json 管道显示输出,但 mat 错误未显示输出。
angular - mat-error 没有出现在 ControlValueAccessor 中
我有一个app-input
使用的自定义组件,mat-form-field
但mat-error
没有出现错误。
我是否NgControl
以formfield
正确的方式分配?
零件
模板
angular - 成功验证后,mat-input 仍然无效 - Angular 12
组件代码-
html代码-
匹配当前密码的验证工作完美,并根据条件显示错误消息。但此后其输入字段仍然无效。
我也尝试过验证其余的输入字段。但是currentPassword仍然无效,这会导致整个表单仍然无效。
为什么会发生这种情况以及如何解决?有谁有想法吗?
angular-material - Angular 11 Custom ISBN Validator Reactive Forms
I'm doing a custom validation for an ISBN number, I already have the function that checks the number and works perfect giving me the response by console, but I need to do the custom validator to get the error in the view with the form control and in this step this error is showing in console when I write an ISBN number, It's like it checks the errors but it doesn't know when its right and it should take the null response as a right ISBN number, at least thats what I saw in some examples.
This is my typescript,
In my HTML I have some inputs that are included in the form:
angular - 角度 materror 检查下拉 ngmodel 对象有效
再会,
通常,我会将下拉值设置为字符串,例如:
下拉列表中设置rReloadType.key
为 的值在哪里,如果用户单击下拉列表,但未选择任何值,则将显示在下拉列表下方。string
reloadTypeObjStr
"reloadTo is required"
我希望有一个下拉列表,将值设置为对象而不是字符串,例如:
where是下拉列表rReloadType
中的对象(而不是),并设置为,这是一个对象。此时,如果用户没有从该下拉列表中选择任何值,则不会显示,此时 mat-error 不起作用。string
reloadTypeObj
reloadTo is required
我想请教一下,有什么我可以做的吗?或者角度不支持这个?我必须使用字符串值而不是对象值进行下拉?
angular - 无效时的mat-form-field轮廓悬停效果
我正在尝试更改背景的颜色,即鼠标悬停时勾勒出的垫子表单字段的颜色。
上面的代码运行良好,当表单控件有效但是当它无效时,我尝试了:
这会永久改变颜色。不仅当我有鼠标悬停时。请帮忙。谢谢,大卫