Angular5: - Невозможно привязать к 'showNavigationArrows', так как это не известное свойство 'ngb-carousel' - PullRequest
0 голосов
/ 14 сентября 2018

Я использую ng-bootstrap 1.xx с Angular5, bootstrap4, и мне нужно настроить NavigationArrows на основе динамических данных, но я получаю при доступе к ним из HTML

App.module.ts

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
imports[NgbModule.forRoot()]

В приложении / accounts accounts.module.ts

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
    imports[NgbModule.] // tried with NgbModule.forRoot().

HTML

<ngb-carousel   #ngbCarouselid="ngbCarousel" [showNavigationArrows]="false"  [interval]="false" [wrap]="false" *ngIf="numReceipts() > 0" class="center-block no-indicators image-view">
</ngb-carousel>

[interval], [wrap] работает нормально, но [showNavigationArrows] выдает ошибку ниже

Can't bind to 'showNavigationArrows' since it isn't a known property of 'ngb-carousel'.
1. If 'ngb-carousel' is an Angular component and it has 'showNavigationArrows' input, then verify that it is part of this module.
2. If 'ngb-carousel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<div class="imgCarousel">

      <ngb-carousel   #ngbCarouselid="ngbCarousel" [ERROR ->][showNavigationArrows]="false"  [interval]="false" [wrap]="false" *ngIf="numReceipts() > 0" class="ce"): ng:///AccountsModule/ReceiptPreviewComponent.html@28:51
Error: Template parse errors:
Can't bind to 'showNavigationArrows' since it isn't a known property of 'ngb-carousel'.
1. If 'ngb-carousel' is an Angular component and it has 'showNavigationArrows' input, then verify that it is part of this module.
2. If 'ngb-carousel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<div class="imgCarousel">

1 Ответ

0 голосов
/ 14 июля 2019

Вам нужно добавить в файл app.module.ts:

 import { NO_ERRORS_SCHEMA } from '@angular/core';

и после импорта: [], добавить

 schemas: [NO_ERRORS_SCHEMA],

надеюсь, это вам помогло:)

...