如何在ASP.NET MVC C#的Html Helper
中包含Angular directives
。我不知道如何包含它。我所做的工作如下:
@Html.EditorFor(model => model.Questions.Question , new{ng_model="quest"})
{{quest}}
但是当我查找没有ng-model directive
的源代码时
发布于 2015-01-02 16:27:43
Html.EditorFor的第二个参数用于扩展的ViewData。它由模板使用。默认模板不使用您的附加条目。但它支持htmlAttributes
@Html.EditorFor(model => model.Questions.Question , new { htmlAttributes = new { ng_model="quest" }})
或者在没有任何模板的情况下渲染它
@Html.TextBoxFor(model => model.Questions.Question, new { ng_model = "quest" })
发布于 2016-11-28 02:00:24
要在Html Helper中包含Angular指令,您应该将null参数作为第二个参数传递,然后在对象中传递angular指令。
@Html.DropDownList("ViewBag-Name", null, new { ng_model = "Model-Name"})
其中ViewBag-Name包含从控制器传递到视图的SelectList对象。
发布于 2018-08-12 07:33:39
@Html.TextBox("Text1",null,@Html.TextBox{ ng_model = "model1“})
https://stackoverflow.com/questions/27739255
复制相似问题