0

My application when starts can automatically navigate to a specified state like this:

localhost://start.html#/case

When a user navigates to this state some parameters are prepared internally to get specific data for templates shown in case state. I need to be able to have an URL with querystring added to the URL in order for the user to copy and paste it into his email or somewhere else. Something like this:

    localhost://start.html?project=1234#/case

I have spent a considerable time trying to make it work. I tried

$location.search('project', '1234');

But could not get an URL that would actually work.

Please help me with this task.

Thanks

2
  • what routing service are you using? routeProvider or stateprovider (ui-router)? Commented Dec 2, 2016 at 2:42
  • I am using $stateProvider to create my states. Commented Dec 2, 2016 at 11:11

1 Answer 1

2

Hi you can add the parameters at the end of the url

localhost://start.html#/case?project=1234

then you can get the parameters in angular using $location

var projectId = $location.search().project;
// or
var projectId = $location.search('project');
// clear url
$location.search('project', null);
Sign up to request clarification or add additional context in comments.

2 Comments

How do I add them to the end of the url?
how you are adding the parameteres internally?? please paste the code, sorry my delay

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.