rather than do this
<input type="checkbox" name="AltSchedule" ng-show="someVar" />
i want to be able to do this
@Html.CheckBoxFor(model => model.AltSchedule, new {ng-show="someVar" })
but i can't seem to find an answer on who to accomplish using the html helpers with angular tags. Is there way to add angular tags to the html attributes parameter for an html helper?
Underscores in the htmlAttributes parameter are converted to hyphens when the control is rendered:
@Html.CheckBoxFor(model => model.AltSchedule, new {ng_show="someVar" })
You can use the overload that takes a dictionary:
@Html.CheckBoxFor(model => model.AltSchedule, new Dictionary<string, object>() { { "ng-show", "someVar" } })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With