如何在Angular JS中单击按钮时向表中添加行?
问题描述:
嗨..
我想在Angular JS中点击按钮(每行包含文本框和下拉列表)向表中添加行。
我尝试了一切,我用Google搜索了一个多星期但是无法解决这个问题。
请帮忙。紧急
Hi..
I want to add rows to a table on click of a button(each row would consists of textboxes and dropdown lists) in Angular JS.
I tried everything,I googled for more than a week but could not crack this.
Please help. Its urgent
答
您好,您可以在控制器中创建一个集合,并将ng-repeat指令用于。然后在单击事件中,您可以向集合中添加元素,这会生成新行。
示例
对于更复杂的功能,您必须了解angularjs指令并实现自己的指令。
Hi, you can create a collection into your controller and use the ng-repeat directive into a . Then in a click event you can add element to your collection, this generate new rows.
Example
For more complex functionality you must understand the angularjs directives and implement your own directives.