Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 10x 10x | import { AsyncPipe } from '@angular/common';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { FieldType, FieldTypeConfig, FormlyAttributes } from '@ngx-formly/core';
import { FormlySelectModule } from '@ngx-formly/core/select';
@Component({
selector: 'formly-field-radio',
template: `
@for (option of props.options | formlySelectOptions: field | async; track option.value; let i = $index) {
<input type="radio"
[id]="id + '_' + i"
[class.is-invalid]="showError"
[attr.value]="option.value"
[value]="option.value"
[formControl]="formControl"
[formlyAttributes]="field"
[attr.disabled]="option.disabled || formControl.disabled ? true : null">
<label [for]="id + '_' + i">{{ option.label }}</label>
}
`,
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
ReactiveFormsModule,
AsyncPipe,
FormlySelectModule,
FormlyAttributes,
],
})
export class FormlyFieldRadio extends FieldType<FieldTypeConfig> { }
|