Solved

Route Parameters AngularJS

Posted on 2014-09-22
3
447 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
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
get radio button vale in array 7 35
Need to Modify a Script I found 5 75
JavaScript error 1 33
onOpen 14 35
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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)

771 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