Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Using View Component by taghelper

$
0
0

hi, 

I created a View Component named "LoginForm".

When I use @await Component.InvokeAsync("LoginForm"), it works. But tag helper <cv:login-form></vc:login-form> shows nothing.

I added @addTagHelper *, Web.ViewComponents in _ViewImports.cshtml

My app is asp.net core 2.0 and using sdk 2.0.2.

What did I miss? Thanks.

namespace Web.ViewComponents
{
    /// <summary>
    /// Login Form Component
    /// </summary>
    [ViewComponent(Name = "LoginForm")]
    public class LoginFormViewComponent : ViewComponent
    {
        public async Task<IViewComponentResult> InvokeAsync()
        {
            return View();
        }
    }
}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>