/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/test/base/src/app/lazy/virtual-scroll/virtual-scroll.component.ts
38 строк
900 B
Liam DeBeasi
feat(angular): ship Ionic components as Angular standalone components (#28311)
10 окт 2023, 20:06
Не верифицирован
10 окт 2023, 20:06
57e2476
Код
Авторство
О чём код?
import { Component, OnInit, ViewChild } from '@angular/core'; import { HeaderFn } from '@ionic/core'; import { IonVirtualScroll } from '@ionic/angular'; @Component({ selector: 'app-virtual-scroll', templateUrl: './virtual-scroll.component.html', }) export class VirtualScrollComponent { @ViewChild(IonVirtualScroll, { static: true }) virtualScroll!: IonVirtualScroll; items = Array.from({length: 100}, (_, i) => ({ name: `${i}`, checked: true})); itemHeight = () => 44; myHeaderFn: HeaderFn = (_, index) => { if ((index % 10) === 0) { return `Header ${index}`; } return ''; } myFooterFn: HeaderFn = (_, index) => { if ((index % 5) === 0) { return `Footer ${index}`; } return ''; } addItems() { console.log('adding items'); this.items.push( { name: `New Item`, checked: true} ); this.virtualScroll.checkEnd(); } }