0

Based on this URL, when it hits my angular controller, I need to get a value of wonum, which is "BRK18482020".

http://localhost/RealSuiteApps/RealHelp/-1/Detail?wonum=BRK18482020#/

Is it possible? cant understand how...

documented $location service must work, but it doesnt work :(

constructor(private $location: ng.ILocationService) {
   var wonum = $location.search().wonum; // DOESNT WORK, wonum undefined
   var wonum2 = $location.search()['wonum']; // DOESNT WORK, wonum undefined

doesnt work

enter image description here

UPDATE

Obviously angularJS $location doesn't work.

So, using the standard way to get the param works fine.

var wonum = window.location.search.split("wonum=")[1];
5
  • debug the code and watch the value of $location.search(), it is an object with the parameters, watch the content and tell us what you see... Commented Oct 6, 2016 at 15:27
  • stackoverflow.com/questions/11063673/… Commented Oct 6, 2016 at 15:29
  • user449689, how else do you think I get undefined? of course I debug it Commented Oct 6, 2016 at 15:34
  • 1
    @monstro what is the value of $location.search()? Does that have any data? Commented Oct 6, 2016 at 16:02
  • @monstro I understand that $location.search().wonum is undefined, but what is the value of just $location.search() ? Commented Oct 6, 2016 at 16:13

1 Answer 1

0

See this post. Angularjs $location service apparently not parsing url?

You are most likely missing $locationProvider.html5Mode(true); in your app config. Also note, you will need a base tag in your html. <base href="/baseUrl" />

This also falls back to using the # in the url.

Sign up to request clarification or add additional context in comments.

Comments

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.