diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts index cd54221e32..6f1fc90f5e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts @@ -140,7 +140,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie }); this.connectorForm.get('type').valueChanges.subscribe(type=> { - if(type && this.initialConnector === null) { + if(type && !this.initialConnector) { this.attributeService.getEntityAttributes(this.device, AttributeScope.CLIENT_SCOPE, [`${type.toUpperCase()}_DEFAULT_CONFIG`], {ignoreErrors: true}).subscribe(defaultConfig=>{ if (defaultConfig && defaultConfig.length) { @@ -322,6 +322,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie } private clearOutConnectorForm(): void { + this.initialConnector = null; this.connectorForm.setValue({ name: '', type: 'mqtt', @@ -331,7 +332,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie configuration: '', configurationJson: {} }); - this.initialConnector = null; this.connectorForm.markAsPristine(); }