0

My problem is simple, i am on a page of my app, and when i hit reload / refresh button in the browser, instead of load the same page, it fallback to /home, the strange thing is that at the first moment it try to reload the page, but something happen (no console errors) and fallback to /home.

Just to clarify, let's say i got this site map

I got 3 pages, /home, /title, /title/info

So if i am on /title/info (localhost:3000/#/title/info=123), and hit reload /refresh button, instead of view /title/info it will fallback to /home (localhost:3000/#/home)

I am using the stable version of AngularJS.

So anybody can help me to fix this, because it is driving me nuts.

Thanks in advance.

** EDIT ** This is a link to the app.js file to check if it is ok or not.

http://pastebin.com/0AAuASyZ

Tolke
  • 198
  • 1
  • 14

2 Answers2

0

If the URL is meant to have a parameter, as in #/title/info=123, you should define the route accordingly: #/title/info=:infoId, otherwise it probably just considers that the route doesn't match anything and go to the default route.

laurent
  • 88,262
  • 77
  • 290
  • 428
  • That was the first thing i looked, and it is correct all routes are correctly defined, with parameter defined when needed. Discarding it, What could it be?. Thanks for the quick reply – Tolke May 30 '13 at 09:24
  • "So if i am on /title/info (localhost:3000/#/title/info=123), and hit reload /refresh button, instead of view /title/info it will fallback to /home (localhost:3000/#/home)" but the name of the view here is "info=", not just "info". are you sure about the routes? – Eduard Gamonal May 30 '13 at 09:35
  • Yes i am pretry sure that my routes are find. Look I will edit my question and include a link to the routes file. – Tolke May 30 '13 at 13:27
  • @Tolke, in your question you mentioned `title/info` and `title/info=123` but I'm not seeing any route like this in your app.js file. – laurent May 30 '13 at 13:39
  • I mention just for demostration or simple example. The valid routes are those, and as you can see, i think they are well formed, or that is what i think, :D – Tolke May 30 '13 at 14:02
  • @Laurent Sorry to disturb you again, but really I need to find a solution for this strange behaviour, because i cannot nearly nothing. Do you know what may be happening ? – Tolke May 31 '13 at 10:41
  • @Tolke, the routes seem to be well-formed, but if the URL you are trying to access doesn't match anything, it will redirect to the default one. Perhaps if you could post the exact URLs (or at least the paths) you are having trouble with, it might help us figure out the problem. – laurent May 31 '13 at 11:36
  • @Laurent The URL works fine, because i can enter them by links, i mean, I can navigate to them all from the index or any page from the site, all links works, and such. BUT the problem is if i hit refresh button, it redirects me to the home and sometimes if i input the URL in the browser, also redirects me to the Home. – Tolke May 31 '13 at 11:58
0

Ok The problem was human after all (like always). Let's say that my coworker code something like:

Every time there is a reload, switch an event ot "change account" and redirect to home... so that was the problem.

So sorry for the inconvinience and I am going to hang up my coworker.

Thanks for everything

Tolke
  • 198
  • 1
  • 14