Usually AngularJS is used to create a single page application with multiple views. But we can create multiple views in an AngularJS-based single page application by using routing – and in this post we’ll learn how to do that!
What is Routing?
Routing allows us to logically divide the application in the multiple logical views to be loaded asynchronously. Let’s take, for example, a single page Product application. We can break the various tasks that can be performed on that product into separate logical views as shown below,
- · View to add a product
- · View to delete a product
- · View to edit a product
- · View to display the products.
In AngularJS routing, each view has its own URL. For example, the four views of a single page product application as listed above may have URLs as shown below: