0

I am working on an angular application and i have used "$locationProvider.html5Mode(true)" in my route config to avoid /#/ in URL. I have also added base href="/" in index.html and everything is working fine on refresh of pages.

But when i am trying to refresh the page having URL

"http://localhost:3000/home/:JavaScipt%20SC2.0"

Then i am getting Cannot GET /home/:JavaScipt%20SC2.0 error. I think error is due to name "JavaScript SC2.0" containing .(dot) symbol. Any clue to fix this issue?

3
  • how are you getting to that page? - e.g. do you have a link for the route page, if so - how does it look like? - also what is your route config? Commented May 25, 2017 at 8:53
  • I have route config something like ".when('/home/:type', { templateUrl: 'app/dashboard/views/home.html' , controller: 'homeCtrl' , controllerAs: 'home' }" . Above route is working properly for other "type" value but for "JavaScript SC2.0" I am getting error. When i am navigating to this url through my base home page then it is working properly, only issue is with hard refreshing. Commented May 25, 2017 at 11:20
  • I know this is going to sound stupid, but try to trim the space and the dot in the name, and retry, if it works, add the space and retry, then the dot, so you can try to trace the error and post a little more information about what error is displayed Commented May 26, 2017 at 9:14

2 Answers 2

1

But when i am trying to refresh the page having URL

"http://localhost:3000/home/:JavaScipt%20SC2.0"

Your route has at least two problems:

  • First, document name misspelled, shouldn´t it be JavaScript? (with R)
  • Second, you can´t use home/ : Jav... (/:Javascipt??)

try again with http://localhost:3000/home/JavaScript SC2.0 into a variable and pass it.

More info in this link

PS: If (whoever) knows so much that can mark my answer as not valid, please ALSO post a valid answer, not just a negative ;)

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

1 Comment

It is a typo in above question, i am trying with url "localhost:3000/home/:JavaScript%20SC2.0". I am using ":type" in route config because the "type" value is dynamic and it can be change based on some condition.
0

you can try on send it on another state: or you can use the $window dependency into your controller, and use as javascript.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.