我想要的「5分鐘快速入門」使用一些外部CSS爲我的組件如何在Angular 2中加載外部CSS?
這是我試過(以下this example):
import { Component } from '@angular/core';
import { ViewEncapsulation } from '@angular/core';
@Component({
selector: 'my-selector',
templateUrl: 'app/shared/my.component.html',
styleUrls: ['https://example.com/themes/default/style.css'],
encapsulation: ViewEncapsulation.None,
})
在檢查代碼plnkr
樣式不適用於我的組件,當從「開發人員工具」中檢查「Sources」時,外部CSS中的images/fonts /似乎沒有加載。 有什麼,我失蹤了?
其中角版本您使用的?嘗試在你的組件中設置'moduleId:module.id' – candidJ
@candidJ我正在使用RC5,我試圖在組件中添加moduleId:module.id,我有相同的行爲 –