Solved

Routing based on dropdown change in angularjs

Posted on 2014-11-08
1
476 Views
Last Modified: 2014-11-12
Hi,

We are developing single page application using angularjs and our index page consists of 3 sections so we have separate pages/partial views  for these sections.My requirement is in the index page we will have dropdown with 3 options and based on option selected I have to show that section(page/html).So in the dropdwon on ng-change there is  a function that will pass selected value to controller and show respective page/view.I am injecting $location service into the controller and showing the respective page/view.But I came to know that using $location service  will redirect to sepearte html/page and will show different url in the address bar of a browser.

I want to show the page/html based on dropdown change without using $location service in the controller, I tried injecting $route into the controller but getting error.Can anyone correct me how to resolve this issue.Here is the plunker routing
0
Comment
Question by:ksd123
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40431732
check the example here at the bottom : https://docs.angularjs.org/api/ng/directive/ngInclude

you may use ng-if too
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to count occurrences of each item in an array.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now