Listening for User Change Events

We now have everything in place to allow the user to edit data in our Angular app, including validations and user feedback using Bootstrap. Now, we need to save that data back to the server whenever it changes.

We could certainly add a button to CustomerDetailsComponent, add a click handler to it, and do an Ajax POST to the server with the customer data. But, in the interest of learning something we don’t already know, let’s design the app so that whenever the user tabs off of a control, that change is saved back to the server automatically. This allows us to take a look at a new way components can communicate: event emitters.

Communicate Between Parent and Child Components with Event Emitters

You’ve seen ...

Get Rails, Angular, Postgres, and Bootstrap, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.