我是angular 2的新手,我所做的是使用angular无限滚动并在滚动滚动时加载数据,但它会提示一些错误无法绑定属性,我在下面说明了错误:
安装有角度的2-infinite-scroll
import { NgModule, enableProdMode, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';
import { Routes } from '@angular/router';
import { AppComponent } from './app/app.component';
/* Feature Modules */
import { DatepickerModule } from 'ng2-bootstrap/ng2-bootstrap';
import { PlanModule } from './plan.module';
import { InfiniteScrollModule } from 'angular2-infinite-scroll';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
enableProdMode();
@NgModule({
imports: [
BrowserModule,
HttpModule,
FormsModule,
DatepickerModule.forRoot(),
PlanModule,
InfiniteScrollModule
],
declarations: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);
添加html页面
<div id="activityList" *ngIf="structure.jobplan" infinite-scroll
[infiniteScrollDistance]="2"
[infiniteScrollThrottle]="300"
(scrolled)="bindActivitiesOnScroll($event)" >
然后我得到了错误:
Uncaught Error: Template parse errors:
Can't bind to 'infiniteScrollDistance' since it isn't a known property of 'div'. ("
<div id="activityList" *ngIf="structure.jobplan" infinite-scroll
[ERROR ->][infiniteScrollDistance]="2"
[infiniteScrollThrottle]="300"
(scrolled)="bindAct"): ng:///ActivityModule/ActivityListComponent.html@5:12
Can't bind to 'infiniteScrollThrottle' since it isn't a known property of 'div'. ("t" *ngIf="structure.jobplan" infinite-scroll
[infiniteScrollDistance]="2"
[ERROR ->][infiniteScrollThrottle]="300"
(scrolled)="bindActivitiesOnScroll($event)" >
"): ng:///ActivityModule/ActivityListComponent.html@6:12
at syntaxError (index.ts:26)
at TemplateParser.parse (index.ts:26)
at JitCompiler._compileTemplate (index.ts:26)
at index.ts:26
at Set.forEach (<anonymous>)
at JitCompiler._compileComponents (index.ts:26)
at index.ts:26
at Object.then (index.ts:26)
at JitCompiler._compileModuleAndComponents (index.ts:26)
at JitCompiler.compileModuleAsync (index.ts:26)
我在google上搜索了一下,但找不到一个解决方案,为什么它不允许绑定属性,
找不到我犯的错误请帮帮我