core/dynamic-forms/select/select.type.component.ts
FieldType
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | c8y-select-type |
| standalone | true |
| imports |
FormlyModule
NgFor
C8yTranslatePipe
|
| templateUrl | ./select.type.component.html |
FormsModule
ReactiveFormsModule
FormlyModule
NgFor
AsyncPipe
C8yTranslatePipe
FieldType
OnInit
<div class="c8y-select-wrapper">
<select
class="form-control"
[class.is-invalid]="showError"
[formControl]="formControl"
[formlyAttributes]="field"
[required]="properties.required"
>
<option
[disabled]="
properties.required ||
(properties.acceptUndefined != null ? !properties.acceptUndefined : true)
"
[ngValue]="undefined"
selected
>
{{ placeholder$ | async | translate }}
</option>
<ng-container *ngFor="let opt of options$ | async">
<option
[ngValue]="opt[valueProp]"
[disabled]="opt.disabled || false"
>
{{ opt[labelProp] | translate }}
</option>
</ng-container>
</select>
</div>