Шаблон разбора ошибок angular5 карма жасмин2.8.0 - PullRequest
0 голосов
/ 29 апреля 2018

Моя страница Angular 5 работает отлично. Но при выполнении тестовых случаев я получаю ниже упомянутую ошибку.

Failed: Template parse errors:
    Can't bind to 'images' since it isn't a known property of 'angular-image-slider'.
    1. If 'angular-image-slider' is an Angular component and it has 'images' input, then verify that it is part of this module.
    2. If 'angular-image-slider' 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="foot">
       <h4 class="lower-headings">Peer Group</h4>
      <angular-image-slider [ERROR ->][images]="imagesUrl" style="height:70%"></angular-image-slider> 


    "): ng:///DynamicTestModule/AppComponent.html@33:24
    'angular-image-slider' is not a known element:
    1. If 'angular-image-slider' is an Angular component, then verify that it is part of this module.
    2. If 'angular-image-slider' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
      <div class="foot">
       <h4 class="lower-headings">Peer Group</h4>
      [ERROR ->]<angular-image-slider [images]="imagesUrl" style="height:70%"></angular-image-slider> 


    "): ng:///DynamicTestModule/AppComponent.html@33:2

*. Component.html

<div class="foot">
   <h4 class="lower-headings">Peer Group</h4>
  <angular-image-slider [images]="imagesUrl" style="height:70%"></angular-image-slider> 
  </div>

*. Module.ts

import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { FinanceserviceService } from './financeservice.service';
import { NgModule,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AppComponent } from './woodside.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SliderModule } from 'angular-image-slider';
import { CommonModule } from '@angular/common';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    BrowserAnimationsModule,
    SliderModule,
  ],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  providers: [FinanceserviceService],
  bootstrap: [AppComponent]
})

export class AppModule { }

*. Component.ts

export class AppComponent {
  title = 'XXXXXXXXX';
  chart = [];
  imagesUrl=[
    'assets/1.jpg',
    'assets/2.png',
    'assets/3.jpg',
    'assets/4.jpg'
    ];
}

Извините за такой глупый вопрос. Я новичок в угловых и пытаюсь исправить ошибку.

1 Ответ

0 голосов
/ 29 апреля 2018
  1. Вы должны импортировать SliderModule в своей тестовой спецификации.

    OR

  2. Если вы тестируете компонент, который не включает тег angular-image-slider (может присутствовать в дочерних компонентах), добавьте schemas: [NO_ERRORS_SCHEMA] в свою тестовую конфигурацию. Это должно устранить ошибку.

...