0

I am developing an App that uses the AngularJs Router.

So my URLs look like that:

appName/viewOrders

My problem is, when I refresh the browser with F5 I get an 404 Error. (Because there isn't a folder or even file named viewOrders)

I can't redirect it via a config file because I am not able to use one in the environment where I am developing (An Sharepoint 2013 App).

So I came to this idea: When I click the navigation, the Url doesn't change and stays at

/appName

But the view does it. How can I achieve it? Have I to use the ui-router?

Roman
  • 3
  • 1
  • 4

2 Answers2

0

Not sure if you've solved this issue but here's a potential solution anyway...

You're using HTML5 mode so you need server-side rewrite as explained here: https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode

However, it sounds like you've got restricted access to a server so why stop HTML5 mode.

Don't hack at it like you're suggesting - that could get nasty.

tommyd456
  • 10,443
  • 26
  • 89
  • 163
  • Thanks for your reply. I have already a solution for it (did it with ng-include at the moment). I am working on a Sharepoint hosted App and am not allowed to do a server side rewrite via a config file or anything else. That is the problem, why I were searching for such a (nasty) solution. – Roman Oct 17 '14 at 14:01
0

If you have restricted access and are unable to use the answer @tommyd456 (which it sounds like that may be the case), another option is to omit the url completely using stateProvider (ui-router).

Angular ui-router: Can you change state without changing URL?

Community
  • 1
  • 1
dannypaz
  • 1,294
  • 1
  • 12
  • 16
  • I have already found a solution that works for me at the moment (did it with ng-include). But thanks a lot for the link, that is for what I were searching :) – Roman Oct 17 '14 at 13:58