2017-05-05 1 views
0

현재 각도 4를 사용하고 있으며 각도 재료 사용 방법에 대한 링크 here을 따랐습니다. 이것은 내가 지금까지 무엇을했는지 있습니다 :각도 재질 코어 테마를 찾을 수 없습니다. 대부분의 재료 구성 요소가 예상대로 작동하지 않을 수 있습니다.

내가 내 index.html을에서 테마 스타일을 포함

import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; 
import 'hammerjs'; 

imports: [ 
    BrowserAnimationsModule 
    ], 

app.module.ts

<head> 
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> 
    <link href="../node_modules/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet"> 
</head> 

구성 요소

<md-sidenav-container> 
    <md-sidenav> 
    un idee 
    </md-sidenav> 

    <!-- primary content --> 
</md-sidenav-container> 

그러나 오류가 발생합니다 :

Unhandled Promise rejection: Template parse errors: 
'md-sidenav' is not a known element: 
1. If 'md-sidenav' is an Angular component, then verify that it is part of this module. 
2. If 'md-sidenav' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 

다음과 같은 경고

Could not find Angular Material core theme. Most Material components may not work as expected 

사람이 내가 잘못 뭐하는 거지 지적 수 있을까요? 당신이 직면하는 경우

'@angular/material': 'npm:@angular/material/bundles/material.umd.js', 

답변

1

당신은 MdSidenavModule 가져 오기를 누락하고

import { MdSidenavModule} from '@angular/material' 

imports: [ 
    BrowserAnimationsModule, MdSidenavModule 
    ], 

은 또한 다음을 확인하여 AppModule에 의존로 추가, 다음 줄은 systemjs 설정 파일에 있습니다 BrowserAnimationsModule, NoopAnimationsModule 오류. 이 post

업데이트를 참조하십시오 : 나는`MdSidenavModule` 수입

+0

버전에 따라 변경 될 경로 : CLI를 들어, 아래 경로

"paths": { "@angular/material": ["../../dist/packages/material/public_api"] } 

참고로 tsconfig-build.json 파일을 업데이트 . 그러나 컴파일 된 'has no exported member' 오류가 발생했습니다. 나는 systemjs 설정 파일이 없으므로 cli를 사용하고 있습니다. – edkeveked

+0

죄송합니다.하지만 tsconfig-build 파일 중 하나가없는 것으로 보입니다. 나는 tsconfig.json을 가지고 있지만 언급 한 것은 아니다. – edkeveked

+0

yes. { "base을": 변화 당신이 '{ "compilerOptions"을 제안 내가 한 – Aravind

관련 문제