C# 如何在CSHTML中使用angular创建下拉列表?

C# 如何在CSHTML中使用angular创建下拉列表?,c#,angular,asp.net-mvc,C#,Angular,Asp.net Mvc,如何使用CSHTML创建下拉选择列表?我尝试了以下两种选择,但都不起作用。 选项1 像这样试试 <select formControlName="countryControl" [(ngModel)]="filter.customers"> <option [value]="customer.CustomerProfileId" *ngFor="let customer of filter.customers"> {{customer.Cus

如何使用CSHTML创建下拉选择列表?我尝试了以下两种选择,但都不起作用。 选项1

像这样试试

<select formControlName="countryControl" [(ngModel)]="filter.customers">
   <option [value]="customer.CustomerProfileId" *ngFor="let customer of filter.customers">             {{customer.CustomerName}}</option>
 </select>

{{customer.CustomerName}

选项1:

  @Html.DropDownListFor(model => model.Gender, new List<SelectListItem>(), new { @class = "form-control", @ng_model = "gender", @ng_options = "item as item.name for item in genders track by item.value" })
<select name="Gender" ng-options="item as item.name for item in genders track by item.value" ng-model="gender"></select>

你能分享Javascript代码并解释你使用的是AngularJs的哪个版本吗?这是AngularJs吗?不是棱角的?这是棱角的
    $scope.customerChange = function (customerId) {
        var temp = customerId;
    }
<select formControlName="countryControl" [(ngModel)]="filter.customers">
   <option [value]="customer.CustomerProfileId" *ngFor="let customer of filter.customers">             {{customer.CustomerName}}</option>
 </select>
  @Html.DropDownListFor(model => model.Gender, new List<SelectListItem>(), new { @class = "form-control", @ng_model = "gender", @ng_options = "item as item.name for item in genders track by item.value" })
<select name="Gender" ng-options="item as item.name for item in genders track by item.value" ng-model="gender"></select>
$scope.genders =
[
    { value: "M", name: "Male" },
    { value: "F", name: "Female" }
];