diff --git a/ui-ngx/src/app/shared/components/json-content.component.ts b/ui-ngx/src/app/shared/components/json-content.component.ts index e957a40d5c..242b4b6359 100644 --- a/ui-ngx/src/app/shared/components/json-content.component.ts +++ b/ui-ngx/src/app/shared/components/json-content.component.ts @@ -92,6 +92,15 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid this.validateContentValue = coerceBooleanProperty(value); } + private validateOnChangeValue: boolean; + get validateOnChange(): boolean { + return this.validateOnChangeValue; + } + @Input() + set validateOnChange(value: boolean) { + this.validateOnChangeValue = coerceBooleanProperty(value); + } + fullscreen = false; contentBody: string; @@ -256,7 +265,7 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid const editorValue = this.jsonEditor.getValue(); if (this.contentBody !== editorValue) { this.contentBody = editorValue; - this.contentValid = true; + this.contentValid = !this.validateOnChange || this.doValidate(); this.propagateChange(this.contentBody); } }