Dynamic text instead of static text in place holder attribute,which comes from a key value pair in localization(.json file), i am working on Aurelia framework I was implementing Localization in a Aurelia project, in one of the files, i was looking for "placeholder" attribute to sport dynamic value rather than static value, if some one could help me with this Thanks! in advance
Heading_Text is a "key value" pair name picked up from some.json for the particular language, the application is loaded in
答案 0 :(得分:1)
Try setting the input placeholder value using Javascript, which will be easier when you need dynamic value
input.attr("placeholder", value);
答案 1 :(得分:0)
这应该可以解决您的问题
<input [placeholder]="variableName" type= "text" [(ngModel)]="modelName"/>
component.ts
variableName = 'placeholder For modelName'
有关更多信息,请检查here
答案 2 :(得分:0)
您可以在component中设置占位符值,它应该可以正常工作。
<input [attr.placeholder]="componentVariable" [(ngModel)]="modelName"/>
或
<input [placeholder]="componentVariable" [(ngModel)]="modelName"/>
您的componentVariable
在组件加载时获得值或在组件中接收到数据后,输入字段占位符应能够根据需要显示文本。