@RenderSection("Scripts",false)
Add to view
ex.
Contact.cshtml
which injects scripts to the view:
@section Scripts{
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
}
full _Layout.cshtml below:
@*
For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
ViewBag.Title = "Home page";
}
<!doctype="html">
<html>
<head>
<title>the world @ViewBag,Title</title>
<meta charset="utf-8" />
<link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" />
<script src="~/lib/angularjs/angular.min.js"></script>
<script src="~/js/app.js"></script>
<script src="~/js/controller.js"></script>
</head>
<body ng-app="app">
<div id="sidebar">
<img src="~/img/greg.jpg" alt="Greg image" class="headshot" />
<span id="username">greg</span>
<ul class="menu">
<li class="active"><a <a asp-controller="app" asp-action="Index">home</a></li>
<li><a asp-controller="app" asp-action="About">About</a></li>
<li><a <a asp-controller="app" asp-action="Contact">contact</a></li>
</ul>
</div>
<div id="wrapper" class="row">
<div id="main">
<h2>The world</h2>
<p>this web site</p>
@RenderBody()
</div>
<div id="footer">©The World Ltd</div>
</div>
<script type="text/javascript" src="~/js/site.js"></script>
@RenderSection("Scripts",false)
</body>
</html>
No comments:
Post a Comment