Using 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 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 hard-codes both the view and the controller. The view is hard-coded by virtue of having all the HTML inside <article ng-app='customers'>. The controller is hard-coded by the use of the ng-controller directive. We’ll break that hard-coding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access