根據Angular Component Styles下的文檔,我試圖導入在node_modules下找到的樣式表;即:Angular 2組件樣式無法解析從node_modules導入的css
test.component.css:
@import '[email protected]/material/core/theming/all-theme.css';
由此分量定義:
@Component({
moduleId: module.id,
selector: 'app-test',
templateUrl: 'test.component.html',
styleUrls: ['test.component.css'],
encapsulation: ViewEncapsulation.None
})
export class TestComponent {
}
不幸的是,當瀏覽頁面,它出現的〜@角/無法找到material/core/theming/all-theme.css。
這個項目是使用Angular-Cli設置的。
我想我可以複製樣式,並引用它們,但我寧願保持圖書館依賴關係分開。
只是爲了確認,您是否安裝了@ angular/material。文件夾結構是否正確以及文件是否存在於node_modules中 – Skeptor
從angular-cli v1.0.0-beta.28.3升級到angular/cli v1.1.2後,這看起來已經解決了。 –