I'm routing the views using ngRoute and not having any particular issues rendering most views. The only problem I am having is when I do a post method and passing a list to the view.
Site/Page renders the view with no layout. Typing into the address bar http://localhost:7351/Page works and provides layout but obviously no View. If I post the form in http://localhost:7351/Main the browser URL changes to http://localhost:7351/Site/Page and displays the results without any layout.
Form in view Main
<form method="post" action="Site/Page">
<input id="chk_main" type="checkbox" />
<input type=submit>
</form>
RouteConfig
routes.MapRoute(
name: "Page",
url: "Site/Page",
defaults: new { controller = "Site", action = "Page" }
);
EDIT: If I change "url: Site/Page" to "url: Page" the Layout will show, but then View won't.
Controller
public ActionResult Index()
{
return View();
}
public ActionResult Main()
{
return View(persons);
}
[HttpPost]
public ActionResult Page()
{
return View();
}
Angular Route Provider:
$routeProvider.
when('/Main', {
templateUrl: 'Site/Main'
})
.when('/contact', {
templateUrl: 'Site/Contact'
})
.when('/Page', {
templateUrl: 'Site/Page'
})
Is there something that i'm missing or don't understand.
_ViewStart.cshtml
page? – haim770 May 12 at 7:22/Site/Main
(for example) normally using the location bar, does the Layout being included? – haim770 May 12 at 7:32