如何在 html 辅助控件中使用 [(ngModel)],例如 @Html.DropDownList

How to use [(ngModel)] in html helper controls such as @Html.DropDownList

我正在使用 angular 7 和 MVC

我需要在 html 辅助控件中使用 [(ngModel)],我尝试了以下方式

 @Html.DropDownList("StateCode", StateList, new { @class = "form-control", @id = "StateCode", @name = "StateCode", ng_model =StateCode" })

但它不绑定下拉值。有什么解决办法吗?

尝试绑定为 [(ngModel)]:

@Html.DropDownList("StateCode", StateList, new Dictionary<string, object>()
    {
        { "class", "form-control" },
        { "id", StateCode },
        { "name", "4" },
        { "[(ngModel)]", "StateCode" }
    })