[Library | Trunk]: Fix portal form undefined error

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60312 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-01-28 16:38:06 +00:00
parent 10cf547544
commit e3ce734445
1 changed files with 6 additions and 4 deletions

View File

@ -181,13 +181,15 @@ export class PortalsComponent implements OnInit {
piwik: this._fb.control(portal.piwik), piwik: this._fb.control(portal.piwik),
type: this._fb.control(portal.type, Validators.required), type: this._fb.control(portal.type, Validators.required),
}); });
this.portalForm.controls['type'].disable(); this.portalForm.get('type').disable();
this.modalErrorMessage = ''; this.modalErrorMessage = '';
this.portalModalOpen('Edit Portal', 'Save'); this.portalModalOpen('Edit Portal', 'Save');
} }
public newPortal() { public newPortal() {
this.portalForm.controls['type'].enable(); if(this.portalForm) {
this.portalForm.get('type').enable();
}
this.portalForm = this._fb.group({ this.portalForm = this._fb.group({
_id: this._fb.control(''), _id: this._fb.control(''),
name: this._fb.control('', Validators.required), name: this._fb.control('', Validators.required),
@ -228,7 +230,7 @@ export class PortalsComponent implements OnInit {
} else { } else {
this.modalErrorMessage = ''; this.modalErrorMessage = '';
if (this.portalForm.value._id) { if (this.portalForm.value._id) {
this.portalForm.controls['type'].enable(); this.portalForm.get('type').enable();
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value, this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
this.properties.adminToolsAPIURL).subscribe( this.properties.adminToolsAPIURL).subscribe(
portal => { portal => {
@ -254,7 +256,7 @@ export class PortalsComponent implements OnInit {
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
}); });
} else { } else {
this.portalForm.controls['type'].enable(); this.portalForm.get('type').enable();
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value, this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
this.properties.adminToolsAPIURL).subscribe( this.properties.adminToolsAPIURL).subscribe(
portal => { portal => {