Dynamically row generation.

60 views
Skip to first unread message

Deeksha Sharma

unread,
Mar 20, 2014, 6:06:06 AM3/20/14
to ang...@googlegroups.com
Is it possible to append a row to a table having textboxes and simultaneously binding its data to ng-model.

Thanks in advance. 

Lorenzo Bugiani

unread,
Mar 20, 2014, 7:17:55 AM3/20/14
to ang...@googlegroups.com
Sure!
Here it is a pluker to show how to do it: http://plnkr.co/edit/t1KufAQPblPaAinemgkU?p=preview
In this case, for brevity, I haven't create textboxes, but the the only difference is the HTML code.
The Angular code is the same: you have a table that show some objects contained in an array: just push another element in your array, and the the table will be rerendered because it's model is changed :D
Tell me if something is not clear...


2014-03-20 11:06 GMT+01:00 Deeksha Sharma <deeksha.s...@gmail.com>:
Is it possible to append a row to a table having textboxes and simultaneously binding its data to ng-model.

Thanks in advance. 

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Deeksha Sharma

unread,
Mar 21, 2014, 12:39:31 AM3/21/14
to ang...@googlegroups.com
Hi Lorenzo,

You have created it beautifully but my requirement is to create a table spreadsheet using Angularjs and Simultaneously I want to bind it with ng-model. The example was quite ok even helpful for me but still I am unable to generate rows thereafter append it to a table.


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/qxOVfIJqT4g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.

Kamal

unread,
Mar 21, 2014, 5:10:55 AM3/21/14
to ang...@googlegroups.com
Deeksha,

I have update Lorenzo's plnkr to have textareas for each row and bound them using ng-model, hope this what your expecting.
http://plnkr.co/edit/JVHFWU?p=preview

Lorenzo Bugiani

unread,
Mar 21, 2014, 5:19:57 AM3/21/14
to ang...@googlegroups.com
Thanks Kamal :D
Yes, my example did not create textboxes, but the point is the angular code: just push new objects into the array and the table will be re rendered.
Then, what you do into the HTML code is irrelevant for the angular code. You can just display elements, or bind that elements into an input field, and so on...

Gaurav Sharma

unread,
Mar 21, 2014, 5:26:36 AM3/21/14
to ang...@googlegroups.com
Thanks and Regards,
Gaurav Sharma

Reply all
Reply to author
Forward
0 new messages