?
Solved

Routing based on dropdown change in angularjs

Posted on 2014-11-08
1
Medium Priority
?
618 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 1500 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

Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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 the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 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