In this article we will discuses,
- What is AngularJS routing?
- How we create routing in AngularJS?
What is AngularJS Routing: - AngularJS supports a single page application which means we can display multiple pages in a single page. A route is specified in the URL after the # sign.
Thus, all the following URLs point to the same AngularJS application, but each points to a different route:
How we create routing in AngularJS:- For this purpose I created 4 pages: Index.html, Home.html, ContectUs.html and AboutUs.html. I want to display all pages Home, ContectUs, AboutUs
Into index pages and url remain same only at the end of url added # and page name that we define in our routing.
Step 1 - We Created Index.html page where we want to display all my html pages,
Step 2 - We created angular routing,
Step 3 - We added different controller in different pages,
Step 4 - After running we will see output like this. So when we click on button page url same only added Name of view after # symble.