2017-10-21 112 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'] 
}) 
相關問題