Linked Questions

Popular Questions

I have a form that includes an app-ngx-editor, I think I have everything working except for when the user tabs/clicks out of the editor without setting a value. My input box works correctly, when you tab/click out of it, the border on the box goes to red. Right now, when you tab/click out of the editor, it just puts two vertical red lines on the left of the box, see photo below.

Is there a way to get the behavior I'm seeing with the input box and applying it to the app-ngx-editor?

Error Case

HTML:

<div class="alert-box">
  <div class="modal-header">
    <button type="button" class="close" (click)="onCancel()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <div *ngIf="isNew; else modalTitleWithId">
      <h4 class="modal-title">Create New Work Item</h4>
    </div>
    <ng-template #modalTitleWithId>
      <h4 class="modal-title">Edit Work Item #{{boardColumnWorkItem.id}}</h4>
    </ng-template>
  </div>
  <form (ngSubmit)="onSubmit()" #workItemForm="ngForm">
    <div class="modal-body" style="width: 598px;border: 1px red solid;">
      <div class="container">
        <div class="row">
          <div class="col-sm-8">
            <div class="row">
              <div class="col-sm-3">
                Title:
              </div>
            </div>
          </div>
        </div>
        <div class="row" style="padding-top:0px;">
          <div class="col-sm-8" style="margin-left: 50px; margin-top: 10px;width: 500px;">
            <div class="form-group">
              <input type="text" [(ngModel)]="boardColumnWorkItem.title" id="title" name="title" required #trackTitle="ngModel" style="width: 100%;" />
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-8">
            <div class="row">
              <div class="col-sm-8">
                Details:
              </div>
            </div>
          </div>
        </div>
        <div class="row" style="padding-top:0px;">
          <div class="col-sm-8" style="margin-left: 50px; margin-top: 10px;width: 500px;">
            <div class="form-group">
              <app-ngx-editor [(ngModel)]="boardColumnWorkItem.description"
                          [ngModelOptions]="{standalone: true}"
                          [config]="editorConfig" required #trackDescription="ngModel">
              </app-ngx-editor>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button id="editCreateCloseButton" type="button" class="btn btn-default" (click)="onCancel()">Cancel</button>
        <button id="editCreateSubmitButton" type="submit" class="btn btn-default" [disabled]="!workItemForm.form.valid">{{isNew ? 'Save' : 'Update'}}</button>
      </div>
    </div>
  </form>
</div>

CSS:

.ng-invalid.ng-touched:not(form) {
    border: 1px solid red;
}

Related Questions