Angular 2 external style doesn't get inlined to header

后端 未结 3 399
遥遥无期
遥遥无期 2020-12-11 21:24

I have this component definition in typescript:

import {Component, ViewEncapsulation} from \'angular2/core\';

@Component({
    selector: \'my-app\',
    tem         


        
3条回答
  •  北海茫月
    2020-12-11 22:01

    You can use systemjs and commonjs module dependencies loader, to load templates, styles and other files.

    in commonjs moduleId : module.id in systemJs __moduleName

    import {Component} from '@angular/core';
    
    @Component({
    
    moduleId:module.id,
    selector: "exf-header",
    templateUrl: "header.html",
    styleUrls:['header.css']
    
    })
    
    export class HeaderComponent {
    
    }
    

提交回复
热议问题