Configuring Angular’s Router for User Navigation

Like Rails, Angular has a way to support navigation-by-URL. Because Angular’s design ethos is based around flexibility, an Angular app isn’t required to use the router, though in most cases you would, and you would set it up from the start. We didn’t initially, just to keep our introduction to Angular as simple as possible and reduce the number of new concepts you had to absorb.

Now, we’ll need to convert our existing Angular app to use the router.

Currently, our Angular app just renders the CustomerSearchComponent’s view, since we’re using its selector—shine-customer-search—in our Rails view. Instead, we’re going to configure Angular’s router, which allows us to specify which components are ...

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.