2

I am using Angular 2 infinite scroll module, I am using the same code that has been given in the module page still I am facing issue as

"EXCEPTION: Error: Uncaught (in promise): Template parse errors: Can't bind to 'infinitescrolldistance' since it isn't a known native property (" grey-color">][infinitescrolldistance]="2" (scrolled)="onScroll()" class="search-results">"

I have included the module in component.ts like

"import { InfiniteScroll } from 'angular2-infinite-scroll';"

and also in directive path.

When I remove infinitescrolldistance property, I am facing

"EXCEPTION: TypeError: Cannot read property 'zone' of null".

Below is my code in jade format. Can you please help me out to find out the issue that I am facing.

div(layout= "row")
  div.md-whiteframe-6dp.white-color(flex="20",style="min-height:500px")
    sd-sidenav
  div.md-whiteframe-5dp.grey-color(flex="35" layout="column")
   div(flex="90")
    md-subheader.grey-color
    .search-results(infinite-scroll='', (scrolled)='onScroll()')
      md-list.carestream-listing.md-whiteframe-z2.md-margin.white-color(*ngFor ="#carecircle of carecircleMemberList; #index = index", (click)="showCareCircle(carecircle._id)" , [ngClass]="{pullright : activeItem === carecircle._id}")
        div
          .md-list-item.md-2-line
            img.md-avatar(style="border-radius:50%",src='./client/app/assets/images/defaultprofile.jpg', alt='Image')
            .md-list-item-text(layout='row')
              div(flex='80')
                h3 {{carecircle.firstName}} {{carecircle.lastName}}
              //p {{carecircle.status}}
              div(layout='row',flex='20',layout-align ='end end')
                span(*ngIf='showMemberDeleteCheckbox')
                  md-checkbox.md-primary((click)="storeDeleteMember(carecircle, $event)")
1
  • Angular2 doesn't have an infinite scroll module. What infinity scroll are you using? Commented Apr 18, 2016 at 6:23

2 Answers 2

1

NOTE: For new users, angular2-infinite-scroll is deprecated now. You should use ngx-infinite-scroll instead.

You need to import and export the module in your module.ts incase you have a child module from where you are registering your components. This is usually in scenarios where we use shared modules or route-specific modules.

Sample shared.module.ts :

import { NgModule } from '@angular/core';
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
import {SampleComponent} from './sample.component.ts';

@NgModule({
  declarations: [
    SampleComponent
  ],
  imports: [
    InfiniteScrollModule
  ],
  providers: [
  ],
  exports: [
    SampleComponent,
    InfiniteScrollModule
  ]
})
export class SharedModule { }

Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

got error after import- with 'InfiniteScrollModule' is deprecated.ts(6385)
0

If you bind a literal value you don't need [] especially if you get this error message which means there is no infinitescrolldistance property

infinitescrolldistance='2',

or

[attr.infinitescrolldistance]="'2'"

for explicit attribute binding.

12 Comments

we have to define that property in html right? then how come it is not taking the infinite scroll distance property
As mentioned in my comment to your question. I have no idea what infinite scroll component you're using and therefore I can't check what infinitescrolldistance is supposed to be or how it is supposed to be used. Angular by default binds to properties not attributes stackoverflow.com/questions/6003819/…
I am not using any component for this, just in my corresponding ts file I have imported infinite scroll module thats it.
I don't know of any infinite scroll module, so where did you import it from.
I found it github.com/orizens/angular2-infinite-scroll/blob/…. That's clearly an error in the readme. Have you tried my proposed solution?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.