通过模型更改输入占位符的值? [英] 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屋!
查看全文