Answer the question
In order to leave comments, you need to log in
Why is the select selection left empty?
TS:
ngOnInit() {
this.route.data
.subscribe(data => {
console.log(data);
var params = data['params'];
this.car_brands = params['car_brands'];
this.car_classes = params['car_classes'];
this.taxi_brands = params['taxi_brands'];
this.client_types = params['client_types'];
this.tariffs = params['group_tariffs'];
Object.assign(this.model, data['data']);
console.log(data);
},
error => {
console.log(error['error']);
this.errors = error['error'];
});
}
<div [ngClass]="hasError('number')" class="form-group">
<label class="col-lg-3 control-label">Номер:</label>
<div class="col-lg-9">
<input type="text" class="form-control" [(ngModel)]="model.number" name="number">
<span *ngIf="errors['number']" class="help-block">{{errors['number'][0]}}</span>
</div>
</div>
<div [ngClass]="hasError('brand_id')" class="form-group">
<label class="col-lg-3 control-label">Бренд такси:</label>
<div class="col-lg-9">
<select name="repeatSelect" id="repeatSelect" class="form-control" [(ngModel)]="model.brand_id" >
<option *ngFor="let item of taxi_brands;" [value]="item['id']"> {{item.name}} </option>
</select>
<span *ngIf="errors['brand_id']" class="help-block">{{errors['brand_id'][0]}}</span>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question