【发布时间】:2018-02-16 17:07:57
【问题描述】:
我有输入:
<input class="form-control" type="text" [(ngModel)]="context.company.city.zipCode">
并在 2 次打开弹出模式:当我单击“新建”按钮时,或者当我在网格中双击公司以编辑该公司的属性时。
我的输入在 CompanyTemplatePopupComponent 中,该组件在启动时导入到此组件中,以防必须引导某些路径来影响输入。
我想要的是以这种方式在 this.modal.open 函数中编写,当我打开 editCompany - 输入被禁用时,当 newCompany 被激活,输入字段也被启用。 isUpdate 已经是布尔值,如果有帮助的话。
openCompanyPopup( isUpdate, company ) {
let companyToEdit = isUpdate ? company : this.companyTemplate;
this.modal.open( CompanyTemplatePopupComponent, overlayConfigFactory( {
dialogClass: 'modal-dialog style-dialog',
company: companyToEdit,
isUpdate: isUpdate,
countries: this.countries,
}, BSModalContext ) )
.then(( d: any ) => d.result )
.then( result => {
if ( isUpdate ) {
this.companyService.editCompany( result )
.subscribe( company => {
this.companyService.get().subscribe( response => this.handleSuccess( response ) );
} );
}
else {
this.companyService.newCompany( result )
.subscribe( company => {
this.companyService.get().subscribe( response => this.handleSuccess( response ) );
} );
}
} );
}
【问题讨论】:
标签: angular input bootstrap-modal disabled-input