View components are another brand-new feature in ASP.NET Core that combines server code with view code to encapsulate chunks of the response.
- [Instructor] Another new feature in ASP.NET Core…are View Components, and these combine…server-side code with partial views…and are used to render a chunk of the response.…Some common uses are dynamically created menus,…like in the sample app provided for you,…a login panel or a shopping cart.…There are some limitations.…They can't serve as a client-side end point,…they don't use model binding, and they don't participate…in the controller lifecycle.…
So, they're very similar to child actions,…which have gone away, combined with partial views.…To create a ViewComponent class,…create a new public, non-nested, non-sealed class,…and those are actual requirements.…Derive from ViewComponent.…You don't have to derive from ViewComponent,…there's some other games you can play,…but really, to get the most value out of a view component,…you should derive from a ViewComponent.…And then, you implement the InvokeAsync…and return an IViewComponentResult,…which is typically a view.…
Any data needed for the view…needs to be passed into the view as a viewmodel,…
- Running and debugging ASP.NET Core applications
- Pros and cons of migrating existing applications to ASP.NET Core.
- Built-in dependency injection
- Environment awareness and app configuration
- Web host configuration and SSL
- View components invoked as tag helpers
- Configuration and logging
- Using Razor Pages
- Web API improvements
- Support for creating GDPR-compliant applications
Skill Level Intermediate
Use the exercise files3m 37s
1. Get to Know .NET Core
2. ASP.NET Core 1.0
3. ASP.NET Core 1.1
4. ASP.NET Core 2.0
5. ASP.NET Core 2.1
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.