如何在剃刀中添加角标签到html属性

Mic*_*ael 20 asp.net-mvc razor angularjs

而不是这样做

<input type="checkbox" name="AltSchedule" ng-show="someVar" />
Run Code Online (Sandbox Code Playgroud)

我希望能够做到这一点

@Html.CheckBoxFor(model => model.AltSchedule, new  {ng-show="someVar" })
Run Code Online (Sandbox Code Playgroud)

但我似乎无法找到使用带角度标签的html助手完成的答案.有没有办法为html帮助器的html属性参数添加角度标签?

ajb*_*ven 39

在呈现控件时,htmlAttributes参数中的下划线将转换为连字符:

@Html.CheckBoxFor(model => model.AltSchedule, new  {ng_show="someVar" })
Run Code Online (Sandbox Code Playgroud)