0

I get the error above when I set my templateUrl, .cshtml, as controller view in asp mvc. My code is below:

app.config(["$routeProvider", function($routeProvider) {
    $routeProvider
        .when("/Default", {
            templateUrl: "/Partials/ViewAccountPartial.html",
            controller: "viewAccountController"
        })
        .when("/EditAccount", {
            templateUrl: "/Partials/EditAccountPartial.html", <=== NO PROBLEM WITH THIS
            controller: "editAccountController"
        })
        .when("/ViewVisitors", {
            templateUrl: "/Partials/ViewVisitorsPartial.html", <=== NO PROBLEM WITH THIS
            controller: "viewVisitorController"
        })
        .when("/ViewItineraries", {
            templateUrl: "/Itinerary/ViewItineraries",  <===== Controller/Action [THIS CAUSES THE ENDLESS LOOP]
            controller: 'viewItineraryController'
        })
        .otherwise({ redirectTo: "/Default" });
}])

asp mvc controller

[Authorize(Roles = "ViewItineraries")]
public ActionResult ViewItineraries()
{
    return View("ViewItineraries");
}

Can you help please?

2
  • Did u see that template url "Itinerary/ViewItineraries" is missing HTML at the end. "Itinerary/ViewItineraries.html". is this a typo ? Commented Jan 23, 2018 at 2:22
  • "Itinerary" is the name of the Controller and the "ViewItineraries" is the name of the Method that returns a View which is a ".cshtml". I am using angularjs in ASP MVC Commented Jan 23, 2018 at 2:23

1 Answer 1

1

For those who may be curious, this is how I resolved the issue. Make sure that you are authorize if it has the "Authorize annotation" in your ASP Controller and return a "partial" view if you need to place the html tags in the ng-view directive.

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

2 Comments

If you have the time, it's better to change partial views to json data while using angular or any other javascript frameworks.
Hmmm... Good lesson for me. Though I haven't tried that yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.