File

core/dynamic-forms/select/select.type.component.ts

Extends

FieldType

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(translateService: TranslateService)
Parameters :
Name Type Optional
translateService TranslateService No

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

defaultPlaceholder$
Default value : defer(() => isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options) ).pipe( map(data => get(data[0], this.labelProp)), map(example => this.translateService.instant( !example ? gettext('No items') : gettext('Select your option, for example, {{ example }}'), { example } ) ) )
labelProp
Type : string
Default value : 'label'
options$
Default value : defer(() => isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options) )
placeholder$
Default value : defer(() => of(this.properties?.placeholder)).pipe( switchMap(placeholder => placeholder ? of(placeholder) : this.defaultPlaceholder$.pipe( startWith(this.translateService.instant(gettext('Select your option'))) ) ) )
properties
valueProp
Type : string
Default value : 'value'
<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 ?? 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>

results matching ""

    No results matching ""