refactoring
This commit is contained in:
parent
799474a066
commit
c1d3ac8f43
@ -124,7 +124,7 @@ export class ModbusBasicConfigComponent implements ControlValueAccessor, Validat
|
|||||||
validate(basicConfigControl: UntypedFormControl): ValidationErrors | null {
|
validate(basicConfigControl: UntypedFormControl): ValidationErrors | null {
|
||||||
const masterHasSlaves = !!basicConfigControl.value.master?.slaves?.length;
|
const masterHasSlaves = !!basicConfigControl.value.master?.slaves?.length;
|
||||||
const slaveEnabled = this.enableSlaveControl.value;
|
const slaveEnabled = this.enableSlaveControl.value;
|
||||||
const slaveIsValid = this.basicFormGroup.get('slave').valid;
|
const slaveIsValid = this.basicFormGroup.valid;
|
||||||
|
|
||||||
if ((slaveEnabled && slaveIsValid) || (masterHasSlaves && !slaveEnabled)) {
|
if ((slaveEnabled && slaveIsValid) || (masterHasSlaves && !slaveEnabled)) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user