[ASP.NET MVC]HTMLHelper work with AngularJs

當要在htmlHelper裡面使用angularjs的屬性時, 原本的ng-model變成ng_model, 將 - 變成 _ 即可

例如:

1
2
3
4
5
6
@Html.DropDownList("dropdown", (IEnumerable<SelectListItem>)ViewBag.items, new { ng_model = "currentSelect", ng_change = "selectChanges()" })

會產生
<select id="dropdown" name="dropdown" ng-change="selectChanges()" ng-model="currentSelect">
<options>something</options>*n
</select>