When attempting to populate a combobox with the value from a selected row, only the inputs are loading.
This section is part of my page:
` <form class="form-horizontal form-label-left parsleyjs" method="post" data-parsley-priority-enabled="false" novalidate="novalidate">
<fieldset>
<div class="form-group row">
<label class="form-control-label labelName" for="basic-change">
Name
</label>
<div class="inputName">
<input #newRole type="text" id="basic-change" name="basic-change" class="form-control" data-parsley-minlength="4" data-parsley-trigger="change"
maxlength="50" value="{{role.name}}" required="required">
</div>
</div>
<div class="inputName">
<select #newEnv class="form-control" required="required">
<option value="b">Back Office</option>
<option value="c">Casino</option>
<option value="s">Store</option>
</select>
</div>
div class="form-group row">
<label class="form-control-label labelName" for="basic-change">
Description
</label>
<div class="inputName">
<input #newDesc type="text" id="basic-change" name="basic-change" class="form-control" data-parsley-minlength="4" data-parsley-trigger="change"
value="{{role.description}}" required="required">
</div>
</fieldset>
</form>
Below is my component:
export class RolesReplaceComponent implements OnInit {
@ViewChild('modal') public modal: ModalDirective;
mensaje: string;
error: boolean;
role;
private isLoading = false;
constructor(
private route: ActivatedRoute,
private router: Router,
private svrRole: RoleService,
private http: Http,
private trans: TranslateService, ) {
this.error = false;
}
ngOnInit(): void {
jQuery('.parsleyjs').parsley();
this.isLoading = true;
this.svrRole = new RoleService(this.http);
this.route.params
.subscribe(
param => {
this.svrRole.getById(param['id'], null)
.subscribe(
resp => {
console.log(resp);
this.role = resp.data.data;
console.log(this.role);
this.isLoading = false;
console.log('Que sucedio?');
},
error => console.log("Error on edit-roles-services ", error));
}
);
}
}
While the same approach works for loading the inputs, it fails for the <select>
.
Any suggestions on how to make it work?