clr-select.component.html 1.2 KB

123456789101112131415161718192021
  1. <clr-select-container *ngIf="!link; else fieldWithLink" [ngClass]="{ 'touched-and-valid': control.touched && control.valid }">
  2. <label [ngClass]="{ 'label-error': control.touched && control.invalid }">{{ label }}</label>
  3. <select clrSelect [formControl]="control" (change)="handleChange()">
  4. <option *ngFor="let opt of options" [value]="opt.value">{{ opt.label }}</option>
  5. </select>
  6. <clr-control-error>{{ getFirstFailureMsg() }}</clr-control-error>
  7. </clr-select-container>
  8. <ng-template #fieldWithLink>
  9. <clr-select-container class="clr-input-group clr-input-group-sm" [ngClass]="{ 'touched-and-valid': control.touched && control.valid }">
  10. <label [ngClass]="{ 'label-error': control.touched && control.invalid }">{{ label }}</label>
  11. <select [formControl]="control" clrSelect #field (change)="handleChange()">
  12. <option *ngFor="let opt of options" [value]="opt.value">{{ opt.label }}</option>
  13. </select>
  14. <div class="clr-input-group-append">
  15. <button class="btn btn-outline-primary" type="button" (click)="navigate(field)">{{ link.label || 'Details' }}</button>
  16. </div>
  17. <clr-control-error>{{ getFirstFailureMsg() }}</clr-control-error>
  18. </clr-select-container>
  19. </ng-template>