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

Static Readonly CONFIG
Type : ConfigOption
Default value : { types: [ { name: 'select', component: SelectComponent, wrappers: ['c8y-form-field'] }, { name: 'enum', extends: 'select' } ] }
defaultPlaceholder$
Default value : defer(() => isObservable(this.to?.options) ? this.to?.options : of(this.to?.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'
placeholder$
Default value : defer(() => of(this.to?.placeholder)).pipe( switchMap(placeholder => placeholder ? of(placeholder) : this.defaultPlaceholder$.pipe( startWith(this.translateService.instant(gettext('Select your option'))) ) ) )
valueProp
Type : string
Default value : 'value'
<div class="c8y-select-wrapper">
  <select
    class="form-control"
    [formControl]="formControl"
    [class.is-invalid]="showError"
    [formlyAttributes]="field"
    [required]="to.required"
  >
    <option [ngValue]="undefined" selected disabled>{{ placeholder$ | async | translate }}</option>
    <ng-container *ngFor="let opt of to.options">
      <option [ngValue]="opt[valueProp]" [disabled]="opt.disabled || false">
        {{ opt[labelProp] | translate }}
      </option>
    </ng-container>
  </select>
</div>
  

results matching ""

    No results matching ""