0

I am using clarity combobx with my Angular app in a form, I am searching for an entity and selecting it, but in some cases, I delete this entity from the combobx but it maybe could be related to other fields, so I want to show a pop up that shows a message to inform the user that this entity could be used in somewhere else before deleting it. Is there a built-in functionality to do this?

code in component.ts:

this.form = this.fb.group({
    field1: [[]],
    field2: [null]
})

and the code in component.html:

<clr-combobox-container>
  <label>Field 1</label>
  <clr-combobox formControlName="field1"
                name="field1Select"
                appComboboxResetSearchtext
                [clrLoading]="field1ComboboxHelper.isLoading"
                (clrInputChange)="field1ComboboxHelper.triggerSearch($event)"
                (clrOpenChange)="$event ? field1ComboboxHelper.triggerSearch() : null"
                clrMulti="true">
    <ng-container *clrOptionSelected="let selected">{{selected.name}}
    </ng-container>
    <clr-options>
      <clr-option *clrOptionItems="let entity of field1ComboboxHelper.entities | async; field:'name'" [clrValue]="entity">
          {{entity.name}}
      </clr-option>
    </clr-options>
  </clr-combobox>
</clr-combobox-container>

<clr-select-container  *ngIf="this.form.get('field1').value.length>0">
  <label>Field 2</label>
  <select clrSelect name="field2"
          [(ngModel)]="selectedField2"
          (ngModelChange)="onField2Selected()">
    <option *ngFor="let field of this.form.get('field1').value" [ngValue]="field">
      {{field.name | multilanguage | async}}
    </option>
    <option [ngValue]="null">-</option>
  </select>
</clr-select-container>
Hasan Bilal
  • 143
  • 2
  • 7
  • Please show the code that you want help with. There is way too much guesswork for everything who could help you otherwise. – Chris Barr Jul 31 '23 at 14:04
  • @ChrisBarr, sorry for this, I've edited the question, the entities that I selected in field1 I want to show it as options in field2, and if I deleted an entity from the field1 I want to show a pop-up to warn the user that this entity could be used in field2... – Hasan Bilal Aug 01 '23 at 05:29

0 Answers0