而不是这样做
<input type="checkbox" name="AltSchedule" ng-show="someVar" />
我希望能够做到这一点
@Html.CheckBoxFor(model => model.AltSchedule, new {ng-show="someVar" })
但我似乎找不到关于使用带有 Angular 标签的 html 帮助器来完成谁的答案。有没有办法将 Angular 标签添加到 html 助手的 html 属性参数中?
最佳答案
当呈现控件时,htmlAttributes 参数中的下划线将转换为连字符:
@Html.CheckBoxFor(model => model.AltSchedule, new {ng_show="someVar" })
关于asp.net-mvc - 如何在razor中将 Angular 标签添加到html属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19328647/