【发布时间】:2017-11-24 09:08:57
【问题描述】:
这是我的 _ViewStart.cshtml:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
这是我的 _Layout.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- Lots of tags for dependencies -->
</head>
<body>
<div class="container body-content">
@RenderBody()
<div class="divider row top-buffer"></div>
<footer>
<p>© @DateTime.Now.Year - MyApp</p>
</footer>
</div>
</body>
</html>
这是我的 Index.cshtml:
@Html.RenderApiEndpoints()
<script type="text/javascript" src="~/Content/index.js"></script>
<div ng-app="app">
<div ng-view ></div>
</div>
我正在获取 Index.cshtml 之类的:
public class HomeController : Controller
{
[Route("")]
public ActionResult Index()
{
return View();
}
}
由于我使用带有 Angular $routeProvider 的客户端路由,因此我总是在 Index.cshtml 中。此外,我不需要布局,我只需要我的 Index.cshtml。
在浏览器中访问本地主机时,如何避免使用布局文件并直接从我的 Index.cshtml 开始?
【问题讨论】:
-
@testiguy 你解决问题了吗
标签: asp.net .net angularjs asp.net-mvc url-routing