From e7c7e7a61a62559df8e429e7c4946dd935763fb9 Mon Sep 17 00:00:00 2001 From: Scott Addie Date: Sun, 25 Feb 2018 20:47:20 -0600 Subject: [PATCH] Convert to CSHTML snippet types --- aspnetcore/mvc/views/dependency-injection.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnetcore/mvc/views/dependency-injection.md b/aspnetcore/mvc/views/dependency-injection.md index 11fdf5f89e..30c043df05 100644 --- a/aspnetcore/mvc/views/dependency-injection.md +++ b/aspnetcore/mvc/views/dependency-injection.md @@ -57,7 +57,7 @@ The HTML form used to update these preferences includes dropdown lists for three These lists are populated by a service that has been injected into the view: -[!code-csharp[](../../mvc/views/dependency-injection/sample/src/ViewInjectSample/Views/Profile/Index.cshtml?highlight=4,16,17,21,22,26,27)] +[!code-cshtml[](../../mvc/views/dependency-injection/sample/src/ViewInjectSample/Views/Profile/Index.cshtml?highlight=4,16,17,21,22,26,27)] The `ProfileOptionsService` is a UI-level service designed to provide just the data needed for this form: @@ -74,7 +74,7 @@ In addition to injecting new services, this technique can also be used to overri As you can see, the default fields include `Html`, `Component`, and `Url` (as well as the `StatsService` that we injected). If for instance you wanted to replace the default HTML Helpers with your own, you could easily do so using `@inject`: -[!code-html[](../../mvc/views/dependency-injection/sample/src/ViewInjectSample/Views/Helper/Index.cshtml?highlight=3,11)] +[!code-cshtml[](../../mvc/views/dependency-injection/sample/src/ViewInjectSample/Views/Helper/Index.cshtml?highlight=3,11)] If you want to extend existing services, you can simply use this technique while inheriting from or wrapping the existing implementation with your own.