1

I'm using angularjs and .NET MVC together. I'm using an initial _layout.cshtml page, but the rest of the routing is through angular.

However, for the login page, I want a different layout page and I can't figure out how to break-out of the angular routing and get back to the _viewStart.cshtml to pick another layout. In the _viewStart, I have something like this, but I never get to the _viewStart after angular starts to take over the routing.

@{
  if(Request.Path.Contains("Login")) {
      Layout = "~/Views/Shared/_Layout2.cshtml";
  }
  else { 
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
}
6
  • 1
    Bypassing angular routing: stackoverflow.com/questions/20657593/… Commented Mar 17, 2017 at 22:31
  • In what page you are using the ng-view directive Commented Mar 17, 2017 at 22:37
  • 1
    Check this stackoverflow.com/questions/38437355/… Commented Mar 17, 2017 at 22:50
  • @Riv- thanks, but that doesn't seem to work when in html5 mode. Commented Mar 18, 2017 at 0:13
  • @ModarNa, I'll try the window.location. That should work, thanks! Commented Mar 18, 2017 at 0:13

0

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.