Create Routing in AngularJS

In this article we will discuses,

  1. What is AngularJS routing?
  2. 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,

code
Step 2 - We created angular routing,

code

Step 3 - We added different controller in different pages,

code

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.

output
Ebook Download
View all
Learn
View all