I have section for scripts in my _Layout.cshtml:
<html>
<body>
...
@RenderSection("FooterScript", required: false)
</body>
</html>
I have view "Index.cshtml" that contains @Html.RenderPartial("LinksBlock", someModel)
.
LinksBlock partial requires script file "links.js". I want to make links.js inclusion into FooterScript from my partial view, not from main view (main view don't know about dependencies of partial view), and I want to be sure, that if I use more than 1 LinksBlock in my view, only 1 links.js was included. Is it possible?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…