如何在Angular JS中单击按钮时向表中添加行? [英] How to add rows to a table on click of a button in Angular JS?

查看:78
本文介绍了如何在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.


这篇关于如何在Angular JS中单击按钮时向表中添加行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆