From e3ce734445c72fa36010437437cf928381fc2748 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 28 Jan 2021 16:38:06 +0000 Subject: [PATCH] [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 --- dashboard/portal/portals.component.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dashboard/portal/portals.component.ts b/dashboard/portal/portals.component.ts index b4c888c4..b43da0ed 100644 --- a/dashboard/portal/portals.component.ts +++ b/dashboard/portal/portals.component.ts @@ -181,13 +181,15 @@ export class PortalsComponent implements OnInit { piwik: this._fb.control(portal.piwik), type: this._fb.control(portal.type, Validators.required), }); - this.portalForm.controls['type'].disable(); + this.portalForm.get('type').disable(); this.modalErrorMessage = ''; this.portalModalOpen('Edit Portal', 'Save'); } public newPortal() { - this.portalForm.controls['type'].enable(); + if(this.portalForm) { + this.portalForm.get('type').enable(); + } this.portalForm = this._fb.group({ _id: this._fb.control(''), name: this._fb.control('', Validators.required), @@ -228,7 +230,7 @@ export class PortalsComponent implements OnInit { } else { this.modalErrorMessage = ''; if (this.portalForm.value._id) { - this.portalForm.controls['type'].enable(); + this.portalForm.get('type').enable(); this.subscriptions.push(this._helpContentService.updateCommunity(this.portalForm.value, this.properties.adminToolsAPIURL).subscribe( portal => { @@ -254,7 +256,7 @@ export class PortalsComponent implements OnInit { queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); } else { - this.portalForm.controls['type'].enable(); + this.portalForm.get('type').enable(); this.subscriptions.push(this._helpContentService.updateCommunity(this.portalForm.value, this.properties.adminToolsAPIURL).subscribe( portal => {