AngularJS动态地向表单添加文本框元素 [英] adding a textbox element dynamically to a form by AngularJS
本文介绍了AngularJS动态地向表单添加文本框元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用AngularJs动态地向表单添加文本框元素。例如,在这种情况下,我有一个文本和文本框,我想通过使用AngularJs点击一个按钮来添加另一个。
How can we add a textbox element to a form dynamically using AngularJs. For example in this case, I have a text and textbox which I want to add one other of this pair by clicking on a button using AngularJs.
<div ng-app>
<div ng-controller="ClickToEditCtrl">
<div ng-hide="editorEnabled" ng-click="editorEnabled=true">
{{title}}
</div>
<div ng-show="editorEnabled">
<input ng-model="title">
<button href="#" ng-click="editorEnabled=false">Done editing</button>
</div>
</div>
</div>
<div>
<input type="text" placeholder="Enter answer">
</div>
推荐答案
我自己实现了它。您可以在
I implemented it myself. You could dynamically add an element by using ng-repeat in a
<li ng-repeat="elemnt in questionelemnt">
这篇关于AngularJS动态地向表单添加文本框元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文