我正在尝试更改 Controller 中输入占位符的值,但不太清楚如何更改。
input(type='text', ng-model='inputText', side='30', placeholder='enter username')
有没有办法修改模型的元素属性?
最佳答案
您可以与 Controller 中的变量绑定(bind):
<input type="text" ng-model="inputText" placeholder="{{somePlaceholder}}" />
在 Controller 中:
$scope.somePlaceholder = 'abc';
关于angularjs - 通过模型更改输入占位符的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17713137/