AngularJS get and set value
AngularJS get and set value
我想在点击按钮的文本区域内添加签名,注明日期为" signature 07/08/2015"。我怎么能做到这是AngularJS的方式?
假设文本区域包含文本为"This is a text"。点击按钮后,它应该转换为
This is a text
Signature 07/08/2015
用JavaScript的方式很容易做到,但我完全是Angular的初学者。
这是我试图在app.js中获取日期,
$scope.getDate = new Date();
我可以在viewas中使用
<p ng-bind="getDate | date:'MM/dd/yyyy'"></p>
文本区看起来像这样,
<textarea type="text" class="form-control" id="description" name="description" ng-model="description"></textarea>
<a href="javascript:" id="add-signature" onclick="addSignature();">add signature</a> // this needs to be modify in angular way.
简单地说,
- 获取textarea value <
- 附加签名/gh>
- 在textarea 中设置这个新值
试一下
控制器
$scope.addSignature=function(){
$scope.description=$scope.description+ "'nSignature 07/08/2015";
}
<视图/strong>
<a href="javascript:;" id="add-signature" ng-click="addSignature();">add signature</a>
相关文章:
- Firebase迁移-简单的Firebase.set没有'不再工作了——旧的还是新的
- Ember Data DS.Model's set函数不起作用
- 在ember/handlers中使用value和valueBinding有什么区别
- 需要url导航从DropDown Value onClick按钮传递url变量
- 用Javascript在下拉列表中选择VALUE选项
- C#asp.net mvc Set CheckBoxFor已检查的具有Model Value的属性
- 为什么JavaScript可以'找不到给定的InnerHTML并返回Cannot set property
- 无法在基于Cordova的应用程序中读取Set Cookie标头
- HTML Value finding
- Javascript GetElementByID has no value
- 如何获取文本框组的值,并使用jquery将它们放入(key:Value)数组中
- Knockout set Dropdown value
- ExtJS TriggerField set value
- sessionStorage onclick set value
- Set the value of <input type="date"... in jquer
- AngularJS get and set value
- Set Value of input type in <td> through javascript
- HTML+JS: Set value of <select> in Safari Mobile (ios)
- append select set the value jquery
- jQuery - autoNumeric 插件,从 .autoNumeric('set', value) 自动触发 .c