简体   繁体   English

如何通过 Angular 7 中的自定义 angular 指令更改 html 输入标签名称?

[英]How to change html input label name by custom angular directive in Angular 7?

I have multiple html forms where I should change or override input label fields name with defined custom label names using api response.我有多个 html 表单,我应该使用 api 响应使用定义的自定义标签名称更改或覆盖输入标签字段名称。 Can any one tell how should I do by defining custom directive?任何人都可以通过定义自定义指令来告诉我该怎么做吗?

Eg Label name -> First Name now I have to override that label name to some custom name -> Fst Name例如标签名称-> 名字现在我必须将该标签名称覆盖为某个自定义名称-> Fst 名称

Try changing this:尝试改变这个:

this.inputElement.nativeElement.value

to

this.inputElement.nativeElement.innerText

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 ControlValueAccessor Angular 在自定义输入中使用指令 - How To Use A Directive In A Custom Input With ControlValueAccessor Angular 如何在 Angular 中动态更改输入标签? - How to change input label dynamically in Angular? 如何将输入数据值发送到angular-2中的自定义指令? - How to send input data value into custom directive in angular-2? 如何使用angular-2中的输入字段创建自定义指令? - How to make a custom directive with input field in angular-2? 输入元素的Angular 2+自定义指令-如何检测重置调用 - Angular 2+ custom directive for a input element - how to detect a reset call 如何使用动态名称创建Angular 2自定义属性指令? - How can I create Angular 2 custom attribute directive with dynamic name? 如何从angular2中的指令检测输入字段的模型变化 - How to detect change in model for input field from directive in angular2 如何在角度为4的指令的输入字段中获取更改事件 - How to get change event in input field for a directive in angular 4 如何在 formControl 指令获取 angular 之前更改输入值 - how to change value of input before formControl directive get it in angular 如何使用 Jasmine 测试自定义 angular HTML 输入 - How to test custom angular HTML input with Jasmine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM