Like the last question I asked, but a little more complicated.
I have an ASP.Net MVC maintained by Angular.
.when("/Catalog", { templateUrl: "/htm/catalog/catalog.htm" }) .when("/Catalog/:Category1", { templateUrl: "/htm/catalog/search.htm" }) .when("/Catalog/:Category1/:Category2", { templateUrl: "/htm/catalog/search.htm" }) .when("/Catalog/:Category1/:Category2/:Category3", { templateUrl: "/htm/catalog/search.htm" }) .when("/Catalog/:Category1/:Category2/:Category3/:Category4", { templateUrl: "/htm/catalog/search.htm" });
$ locationProvider.html5Mode (true);
And MVC routing looks like this:
// AngularJS Route. This is what allows angular to handle its own routing. routes.MapRoute( "hash", "#/{whatever}/{param}/{param2}/{param3}/{param4}/{param5}", new { controller = "Home", action = "Index", param = UrlParameter.Optional, param2 = UrlParameter.Optional, param3 = UrlParameter.Optional, param4 = UrlParameter.Optional, param5 = UrlParameter.Optional } ); // This catches all of the other requests (eg /img/logo.jpg); routes.MapRoute( "whatever", "{whatever}/{param}", new { controller = "Home", action = "Index", param = UrlParameter.Optional, param2 = UrlParameter.Optional, param3 = UrlParameter.Optional, param4 = UrlParameter.Optional, param5 = UrlParameter.Optional } );
The home / index action just returns my index page:
public void Index() { String html = System.IO.File.ReadAllText(HttpContext.Server.MapPath("~/htm/index.htm")); HttpContext.Response.Write(html); }
The problem I am facing is when I try to hit one of these routes with additional parameters, the page freezes giving this javascript error:
Error: $ 10 digest () fighters reached. Aborting!
Sometimes it will manifest itself endlessly (like a mirror looking in a mirror), which makes me think that a “certain” route causes problems. Without these optional parameters, the route ends completely. Thus, the page renders and the parameters are loaded into $ routeParams, but the page freezes, apparently because it is being rendered by itself.
If I select additional parameters on “any” MVC route and try to route using the hash notation (/ # / Catalog / test), it will load just fine (it does not hang and there are route parameters), but the version is html5 (/ Catalog / test) does not find the MVC route.
It's so clear that my problem is with my routing, but I'm not sure what I'm doing wrong. Can someone shed some light, what could be the problem?