O'Reilly logo

Rails, Angular, Postgres, and Bootstrap by David B. Copeland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required