-
Notifications
You must be signed in to change notification settings - Fork 258
Include (aka Partial)
Ivan Balan edited this page Aug 27, 2016
·
1 revision
Include feature is useful when you have reusable parts of your templates you want to share between different views
Includes are an effective way of breaking up large templates into smaller components. They can reduce duplication of template content and allow elements to be reused.
@model MyProject.TestViewModel
<div>
Hello @Model.Title
</div>
@{ await IncludeAsync("SomeView.cshtml", Model); }
First argument takes a key of the template to resolve, second argument is a model of the view (can be null)