0
私はコンボボックスに選択した行から値を設定しようとしているんだけど、これだけは私のページの私の一部である入力セットコンボボックスの値部材角4
がロード
` <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>
これは私のコンポーネントである
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));
}
);
}
}
私は<select>
いくつかのアイデアをどのように行うのですか?
'this.role'の中で' select'にマップしたい属性の名前は何ですか? – CodeWarrior
2ウェイデータバインディング[こちら](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#binding-syntax)に目を通してください。 –