【问题标题】:How to make FomrGroup readonly in Angular8 without the disabled() function?如何在没有 disabled() 函数的情况下在 Angular 8 中使 FormGroup 只读?
【发布时间】:2020-06-03 08:48:09
【问题描述】:

FormGroup 要么直接从 UrlQuery 参数填充,要么通过用户输入填充。当提供 UrlQuery 参数时,FormGroup 应该是只读的。我看到了 disable() 函数,但这对我不起作用,因为未提交 FormGroup 的值。有什么建议吗?

【问题讨论】:

  • 如果您仍然需要答案,请提供一些代码

标签: angular typescript frontend


【解决方案1】:

使用将只读属性添加到输入标签:

<input controlName="Example" readonly></input>

资源: - https://www.w3schools.com/TAGS/att_input_readonly.asp

【讨论】:

    猜你喜欢
    • 2023-04-08
    • 1970-01-01
    • 2019-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-27
    相关资源
    最近更新 更多