angularjs - 通过模型更改输入占位符的值?

标签 angularjs pug

我正在尝试更改 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/

相关文章:

node.js - res.Send 会导致 404 错误吗?

node.js - Node + Express + Pug 中访问 DOM 的正确方法

javascript - Angular 种子项目 - angular-loader-js 依赖

angularjs - jqyoui-draggable 中的 Angular 拖放传递参数

javascript - angular js peity 不适用于 ng-repeat

html - 使用每行具有多个元素的 Jade/Express.js 渲染表格

javascript - Node.js、express、jade、highcharts 和二维数组

javascript - Angular 事件在 Firefox 中不起作用

javascript - 为什么 Angular 中的 jsonp 总是返回 404 错误作为状态?

javascript - 如何将变量从我的 Controller 传递到 HTML,然后传递到 JS 函数?