2017-08-12 51 views
1

數組我分叉完全工作簡單的角度CLI項目 然而,當我運行它,我得到這個錯誤誤差角:預期「風格」是字符串

角CLI方式正常:

 "styles": [ 
    "../node_modules/bootstrap/dist/css/bootstrap.min.css", 
    "./styles.css" 
    ], 

不知道這個問題可能是什麼,什麼樣的信息,我應該在這裏

感謝提供!

Uncaught Error: Expected 'styles' to be an array of strings. at assertArrayOfStrings (compiler.es5.js:3920) at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNonNormalizedDirectiveMetadata (compiler.es5.js:15170) at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.loadDirectiveMetadata (compiler.es5.js:15092) at compiler.es5.js:26802 at Array.forEach() at compiler.es5.js:26801 at Array.forEach() at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26798) at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26768) at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26697)

+0

你嘗試過使用,而不是''styles' styleUrls'? – QoP

+0

是的,沒有改變(也相當令人驚訝)謝謝! –

回答

0

在你的組件,請確保您有一個數組內即[ ]

例如styleUrlsstyles

templateUrl: './app.component.html', 
styleUrls: ['./app.component.css'] 

你不必改變.angular-cli風格[]

+0

謝謝!在組件中,它只是「styleUrls」,引用組件css –

+0

是的,把它放在[] – Faisal

+0

'styleUrls:['./my.component.css']' – Faisal