2017-10-21 113 views
0

我正在使用Angular-Cli运行我的前端应用程序。Angular Cli-在StyleURL中添加位于node_module目录中的css文件

我想从node_module只添加一个css文件到该特定组件。我不想在CSS文件添加到Angular.cli.json “脚本”:[]数组,

我有以下组成部分:从“@angular

进口{组件,OnInit中} /核心'; @Component({
选择: 'fbsign组分', templateUrl: './fb.signin.component.html',

styleUrls: ['./fb.signin.component.css', '../../node_modules/bootstrap-social/bootstrap-social.css'] }) 

出口类FbSigninComponent {

constructor(){} 

    ngOnInit(): any{} 

     onClick(){ 
       window.location.href ="http://localhost:1337/facebook" 
     } 

}

我认为有些东西阻止了styleURLs []访问位于node_module目录中的css文件。如何解锁它?

回答

0

尝试这样的:

下面home.component.ts文件是按照我的项目的位置

SRC =>程序=>家

这里我home.component.ts

@Component({ 
    selector: 'app-home', 
    templateUrl: './home.component.html', 
    styleUrls: ['./home.component.css', '../../../node_modules/bootstrap/dist/css/bootstrap.css'] 
}) 
相关问题