import { Component , Input } from "@angular/core" ; import { ListService } from "./list.service" ; @ Component ( { selector : "test-inner" , providers : [ ListService ] , template : `
    <div class="{{className}}"
        [scrollWindow]="scrollWindow"
         infiniteScroll
         [infiniteScrollContainer]="selector"
         [fromRoot]="fromRoot"
         [infiniteScrollDistance]="scrollDistance"
         [infiniteScrollUpDistance]="scrollUpDistance"
         [infiniteScrollThrottle]="throttle"
         (scrolled)="onScrollDown()"
         (scrolledUp)="onUp()"
      >
      <section class="content">
        <div *ngFor="let i of array()">
          {{ i }}
        </div>
      </section>
    </div>
  ` } ) export class TestInnerComponent { @ Input ( ) scrollWindow = true ; @ Input ( ) className = "" ; @ Input ( ) selector = null ; @ Input ( ) fromRoot = false ; @ Input ( ) info = "" ; throttle = 300 ; scrollDistance = 2 ; scrollUpDistance = 2 ; constructor ( public listMaker ) { } array ( ) { return this . listMaker . array ; } onScrollDown ( ev ? ) { console . log ( `scrolled down, from ${ this . className } ${ this . info }` ) ; this . listMaker . setDirectionDown ( ) ; } onUp ( ev ? ) { console . log ( `scrolled up, from  ${ this . className } ${ this . info }` ) ; this . listMaker . setDirectionUp ( ) ; } generateWord ( ) { return window [ "chance" ] . word ( ) ; } }