UNPKG

ngx-ui-scroll

Version:

Infinite/virtual scroll for Angular

30 lines 1.2 kB
import { Directive, Input, TemplateRef, ViewContainerRef, ComponentFactoryResolver } from '@angular/core'; import { UiScrollComponent } from './ui-scroll.component'; export class UiScrollDirective { constructor(templateRef, viewContainer, resolver) { this.templateRef = templateRef; this.viewContainer = viewContainer; this.resolver = resolver; } set uiScrollOf(datasource) { this.datasource = datasource; } ngOnInit() { const compFactory = this.resolver.resolveComponentFactory(UiScrollComponent); const componentRef = this.viewContainer.createComponent(compFactory, void 0, this.viewContainer.injector); componentRef.instance.datasource = this.datasource; componentRef.instance.template = this.templateRef; } } UiScrollDirective.decorators = [ { type: Directive, args: [{ selector: '[uiScroll][uiScrollOf]' },] } ]; UiScrollDirective.ctorParameters = () => [ { type: TemplateRef }, { type: ViewContainerRef }, { type: ComponentFactoryResolver } ]; UiScrollDirective.propDecorators = { uiScrollOf: [{ type: Input }] }; //# sourceMappingURL=ui-scroll.directive.js.map