ng-bootstrap Карусель скрывает индикаторы пагинации, 'showNavigationIndicators' не существует для типа 'NgbCarouselConfig' - PullRequest
0 голосов
/ 12 сентября 2018

Я пытаюсь скрыть карусель, используя

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

но не распознает [showNavigationIndicators].

Ошибка, которую я получаю, просто из-за 'showNavigationIndicatiors'

core.js:1448 ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'showNavigationIndicators' since it isn't a known property of 'ngb-carousel'.
1. If 'ngb-carousel' is an Angular component and it has 'showNavigationIndicators' 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 ->][showNavigationIndicators]="false" [interval]="false" [wrap]="false" *ngIf="numReceipts() > 0" class="): ng:///AccountsModule/ReceiptPreviewComponent.html@30:51
Error: Template parse errors:
Can't bind to 'showNavigationIndicators' since it isn't a known property of 'ngb-carousel'.
1. If 'ngb-carousel' is an Angular component and it has 'showNavigationIndicators' 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="imgCaro

Ответы [ 2 ]

0 голосов
/ 17 сентября 2018

У меня точно такая же проблема, как и у вас.Сообщение об ошибке:

Property *'showNavigationArrows' does not exist on type 'NgbCarouselConfig'.*

Я не нашел решения, но думаю, что оно касается версии ng-boostrap, которую мы используем.

В импортированном node_model, внутри carousel-config.d.ts, исходный код на моем локальном компьютере:

export declare class NgbCarouselConfig {
    interval: number;
    wrap: boolean;
    keyboard: boolean;
}

Однако, когда я проверяю github, исходный код выглядит какниже:

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

/**
 * Configuration service for the NgbCarousel component.
 * You can inject this service, typically in your root component, and customize the values of its properties in
 * order to provide default values for all the carousels used in the application.
 */
@Injectable({providedIn: 'root'})
export class NgbCarouselConfig {
  interval = 5000;
  wrap = true;
  keyboard = true;
  pauseOnHover = true;
  showNavigationArrows = true;
  showNavigationIndicators = true;
}

Обратите внимание, что эта функция доступна только в версии 2.2.0.Поэтому проверьте вашу локальную версию ng-bootstrap.

0 голосов
/ 12 сентября 2018

Это работает, но вы не можете увидеть его, потому что вы не включили загрузчик CSS.

Вы можете примерить stackblitz, установив index.html следующим образом:

<!DOCTYPE html>
<html>

  <head>
    <title>ng-bootstrap demo</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
  </head>

  <body>
    <my-app>loading...</my-app>
  </body>

</html>
...