Add a new row into mat-table using angular 4

放肆的年华 提交于 2019-12-21 03:01:24

问题


How to add a new row into Angular Material table manually from a input field.

Please see this image in that if i add a state name and state code it should present in the following table please help me how to achieve it using Angular 4.


回答1:


I've put together a quick example that should give you a good hint as to where to start from: Working demo

This works by using two-way data binding on the input field to keep track of what the user typed in the form. When the add button is then pressed, the table is updated with a new element dynamically created with the input content.



来源:https://stackoverflow.com/questions/49983710/add-a-new-row-into-mat-table-using-angular-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!