如何在 MVC Razor 中将 ng-click 添加到 @Html.TextBoxFor

How to add ng-click to @Html.TextBoxFor in MVC Razor

如何在使用 Html.TextBoxFor 时为我的文本框提供 ng-click 属性?

@Html.TextBoxFor(model => model.User.Firstname, 
new { 
    @class = "form-control required", 
    placeholder = "نام" 
})

将 ng_click 添加到 htmlAttributes 对象。

@Html.TextBoxFor(model => model.User.Firstname, new 
{ 
  @class = "form-control required", 
  placeholder = "نام" , 
  ng_click = "yourFunc()" 
})

*Note : The _ instead of - in ng_click is because C# does not accept -