/
githubmirror
/
ionic-framework
Обзор
Документация
Войти
/
githubmirror
/
ionic-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/src/directives/control-value-accessors/text-value-accessor.ts
26 строк
810 B
Brandy Smith
feat(input-otp): add new input-otp component (#30386)
29 май 2025, 22:10
Не верифицирован
29 май 2025, 22:10
4d6a067
Код
Авторство
О чём код?
import { ElementRef, Injector, Directive, HostListener } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { ValueAccessor } from '@ionic/angular/common'; @Directive({ selector: 'ion-input:not([type=number]),ion-input-otp[type=text],ion-textarea,ion-searchbar', providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: TextValueAccessorDirective, multi: true, }, ], }) export class TextValueAccessorDirective extends ValueAccessor { constructor(injector: Injector, el: ElementRef) { super(injector, el); } @HostListener('ionInput', ['$event.target']) _handleInputEvent( el: HTMLIonInputElement | HTMLIonInputOtpElement | HTMLIonTextareaElement | HTMLIonSearchbarElement ): void { this.handleValueChange(el, el.value); } }