我想使用select这是我的方法将从一个服务获得的id保存到另一个服务中
<select class="form-control" id="select_fac" [(ngModel)]="rep.idfac">
<option selected disabled>Select the company</option>
<option *ngFor="let fact of factory" [ngValue]="fact.id_fac">{{fact.name}}</option>
</select>
我的组件中有这个.ts
factory: Factory[]=[];
rep:Representative= new Representative();
尝试使用ReactiveForms:Angular Docs:Reactive Forms
您可以使用formContralName 绑定数据