6

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.

angular material table

Maarti
  • 3,600
  • 4
  • 17
  • 34
chethu
  • 353
  • 1
  • 5
  • 16

1 Answers1

12

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.

bugs
  • 14,631
  • 5
  • 48
  • 52