Asp.net-Mvc

如何在剃刀的html屬性中添加角度標籤

  • October 11, 2013

而不是這樣做

<input type="checkbox" name="AltSchedule" ng-show="someVar" />

我希望能夠做到這一點

@Html.CheckBoxFor(model => model.AltSchedule, new  {ng-show="someVar" })

但我似乎無法找到關於使用帶有角度標籤的 html 助手完成誰的答案。有沒有辦法將角度標籤添加到 html 幫助器的 html 屬性參數?

htmlAttributes 參數中的下劃線在呈現控制項時轉換為連字元:

@Html.CheckBoxFor(model => model.AltSchedule, new  {ng_show="someVar" })

引用自:https://stackoverflow.com/questions/19328647