0
我目前使用的是角度4,並且我遵循關於如何使用角度材質的鏈接here。這是我迄今所做的:找不到Angular Material核心主題。大多數材質組件可能無法按預期工作
app.module.ts
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import 'hammerjs';
imports: [
BrowserAnimationsModule
],
我在的index.html包括主題風格
<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
任何人都可以指出我在做什麼錯?
我進口'MdSidenavModule':對於CLI,與下面的路徑
注意更新
tsconfig-build.json
文件。但是,它導致編譯錯誤「沒有導出的成員」。 我正在使用cli,所以我沒有systemjs配置文件。 – edkeveked對不起,但似乎我沒有tsconfig-build文件。我有tsconfig.json但不是你提到的那個 – edkeveked
是的。 { 「的baseUrl」:改變,因爲我在該文件中 – Aravind