Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a templateUrl is not found, Angular renders 'index' within 'index' forever. This kills the brower. #60

Open
elliottregan opened this issue Feb 1, 2014 · 3 comments
Labels

Comments

@elliottregan
Copy link

This is a very simple mistake that I made, but it could potentially come up in production and its a browser crashing one.

I overlooked the fact that Angular's templateUrls for its routes.js are defined at the bottom of index.jade. When I tried creating a new view and simply using "new_page" for the templateUrl in routes.js (thinking Express was working some file type independent magic), Angular would route to "new_page", which would cause the server to respond with its "catch-all" which is "index". This loads Angular again, and the cycle continues until the browser crashes or stops the script.

Obviously in this case it was just a stupid mistake, but I feel like it should have defaulted to a 404, or something more graceful. I feel like this has the potential of happening in production... Any thoughts on how to catch this loop if it happens?

@fnakstad
Copy link
Owner

fnakstad commented Feb 3, 2014

This is a rather nasty bug if you do end up with a mistake in your routing setup, but I don't have a good solution for it yet as this is the only way the server can delegate routing of "pretty, html5mode" URL's to the client side (not using the hash symbol for client-side routes). The only solution I can think of is if the server somehow had knowledge of the routes registered on the client-side... Then it could return a 404 for any routes it knew the client would not be able to respond to. I'll think about it some more and leave this issue open in case anyone else has any good suggestions!

@austinpray
Copy link
Contributor

Note: when html5mode is turned off this happens as well. The automatic forward slash adding rule causes it. Just try turning html5mode off and loading a page you aren't supposed to have access to.

@fnakstad fnakstad added the bug label Mar 16, 2014
@anttoon
Copy link

anttoon commented Oct 27, 2014

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants