/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/standalone/src/directives/icon.ts
24 строки
923 B
Liam DeBeasi
feat(angular): ship Ionic components as Angular standalone components (#28311)
10 окт 2023, 20:06
Не верифицирован
10 окт 2023, 20:06
57e2476
Код
Авторство
О чём код?
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, NgZone } from '@angular/core'; import { defineCustomElement as defineIonIcon } from 'ionicons/components/ion-icon.js'; import { ProxyCmp } from './angular-component-lib/utils'; @ProxyCmp({ defineCustomElementFn: defineIonIcon, inputs: ['color', 'flipRtl', 'icon', 'ios', 'lazy', 'md', 'mode', 'name', 'sanitize', 'size', 'src'], }) @Component({ selector: 'ion-icon', changeDetection: ChangeDetectionStrategy.OnPush, template: '<ng-content></ng-content>', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property inputs: ['color', 'flipRtl', 'icon', 'ios', 'lazy', 'md', 'mode', 'name', 'sanitize', 'size', 'src'], standalone: true, }) export class IonIcon { protected el: HTMLElement; constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { c.detach(); this.el = r.nativeElement; } }