通过模型更改输入占位符的价值? [英] Change value of input placeholder via model?
本文介绍了通过模型更改输入占位符的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图改变从控制器,但不能输入占位符的价值完全弄清楚如何。
I'm trying to change the value of the input placeholder from a controller but cant quite figure out how.
input(type='text', ng-model='inputText', side='30', placeholder='enter username')
有没有修改模型的元素属性的一种方式?
Is there a way to modify a model's element attributes?
推荐答案
您可以在控制变量绑定:
You can bind with a variable in the controller:
<input type="text" ng-model="inputText" placeholder="{{somePlaceholder}}" />
在控制器:
$scope.somePlaceholder = 'abc';
这篇关于通过模型更改输入占位符的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文