简体   繁体   中英

Angular 5/Implementing ngx carousel

I am running Angular 5.2.4 and installed ngx-carousel "ngx-carousel": "^1.3.5"

What I have:

<ngx-carousel class="banner" [inputs]="carouselBanner" (carouselLoad)="carouselBannerLoad()">
<ngx-item NgxCarouselItem *ngFor="let tile of carouselBannerItems; let i = index;">
    <div class="bannerStyle" [style.background]="'url(' + tile + ')'">
        <h1>{{i}}</h1>
    </div>
</ngx-item>
<button NgxCarouselPrev class="leftRs">&lt;</button>
<button NgxCarouselNext class="rightRs">&gt;</button>

I have a template parse errors in the console saying:

Can't bind to 'inputs' since it isn't a known property of 'ngx-carousel'.
  1. If 'ngx-carousel' is an Angular component and it has 'inputs' input, then verify that it is part of this module.

  2. If 'ngx-carousel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

What am I doing wrong?

You need to import NgxCarouselModule to your module. Then the issue will be solved.

In your module, add in imports section.

In app.module.ts add import { CarouselModule } from 'ngx-bootstrap/carousel';

then in imports add CarouselModule.forRoot()

You are not importing the modules in the main app.module.ts, thus getting error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM