2017-11-01 2 views
1

안녕하세요 저는 Angular 2 프로젝트에서 작업 중이며 재료 모듈을 많이 사용하고 있습니다. 어떤 이유로 Stepper 모듈을 프로젝트로 가져올 수 없습니다. 그래서 endup 아래로 전체 자료 모듈을 수입 :각도 2 재질 스테퍼가 작동하지 않습니다.

import { CommonModule } from '@angular/common'; 
import { NgModule } from '@angular/core'; 
import { StepperComponent } from './stepper.component'; 
import { MaterialModule } from '@angular/material'; 


@NgModule({ 
    imports: [CommonModule, MaterialModule], 
    declarations: [StepperComponent], 
    exports: [StepperComponent] 
}) 

export class StepperModule {} 

와 나는 그것 그럼 다음과 같은 오류를 얻고있다

<mat-horizontal-stepper></mat-horizontal-stepper> 

수입 테스트와 마찬가지로 아래에있는 내 HTML에 사용

polyfills.dll.js:24743 Unhandled Promise rejection: Template parse errors: 
'mat-horizontal-stepper' is not a known element: 
1. If 'mat-horizontal-stepper' is an Angular component, then verify that it is part of this module. 
2. If 'mat-horizontal-stepper' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<mat-horizontal-stepper></mat-horizontal-stepper>"): [email protected]:0 ; Zone: <root> ; Task: Promise.then ; Value: 

많은 재료 모듈을 사용할 수 있습니다. 이 문제 만 있습니다. 어떤 생각이야? 미리 감사드립니다.

+0

app.module.ts 코드를 게시하십시오. StepperComponent에서 를 사용하고 있습니까? –

+0

네, 내 질문에 언급 한''사용하고 있습니다. 'StepperModule'이 머티리얼 모듈을 임포트하고 있기 때문에'app.module.ts '와 아무런 관련이 없습니다. – chewi

+1

스테퍼 구성 요소는'2.0.0-beta.11'에서 도입되어 'MaterialModule'에 대한 지원을 종료했습니다. ** (변경 내역을 읽었습니까?) ** – Edric

답변

1

모듈을 올바르게 가져 오시겠습니까? NOTMaterialModule 당신의 app.module.ts에, 당신은 MatStepperModule에 가져 오기 및 이 있는지 확인 (2.0.0-beta.11에서 제거 된, here 참조) 확인 :

import { MatStepperModule } from '@angular/material'; 

@NgModule({ 
    imports: [ 
     MatStepperModule, 
     // ... 
    ] 
}) 

이유 왜 작동하지 않았다 스테퍼 구성 요소가를했기 때문에입니다 2.0.0-beta.11에서 새로 추가 (자세한 내용은 위에 언급 된대로 changelog 참조)

관련 문제