Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Route Parameters AngularJS

Posted on 2014-09-22
3
Medium Priority
?
476 Views
Last Modified: 2014-09-23
As I am learning AngularJS, I came to know about that we can embed parameters into the route path.

So the web page will look like      localhost/#/books/12345.

I know it is making my life easy in coding as I can go to 5-6 screens easily by giving parameter in URL.

Is it a good practice to show ID=12345 in a web page? Let me know the advantages or disadvantages, if any?
0
Comment
Question by:rbhargaw
[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
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 40337715
I think it's all about Search Engine Optimization
You can use both.
The main difference between query-string (?) and path(/) parameters.
there's no order with query-string : ?id=10&name=beef same as ?name=beef&id=10
where the order is important with path parameters, route is not the same using :
/name/beef/id/10

so use a path parameter to define your angualr route and optionnaly, if needed, query string parameter

don't forget to take a look to the ui-router project, I'm 99% you are going to move to this router instead the ng-route (whihc is now in a separate file as your know)
0
 

Author Comment

by:rbhargaw
ID: 40337800
Thanks for the info! Another question, I wanted to check if in  real app should the user see that he made a search with id/10 or whatever number. My concern is if I can go to a page using id/10, anyone would be able to go to that data using id/10. How do I control that only specific user can request this information?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 40337823
no, you made a request to the server for the view, it check user session, if it found a valid session it send back the view/data else it fail and your throw the error with angular to display an appropriate page
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

730 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