尝试升级到Angular 6并在index.html中引用以下内容时出现以下错误:
拒绝应用“ https://localhost:44394/~/assets/primengcss/themes/omega//theme.css”中的样式,因为它的MIME类型(“ text / html”)不是受支持的样式表MIME类型,并且启用了严格的MIME检查。
答案 0 :(得分:5)
经过一番摸索,找到了答案(至少对我有用)
就像inAngular 6一样,我们需要将所有外部CSS(例如bootstrap,fontawesome,Primeng等)包括到angular.json中,如下所示:
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/font-awesome/css/font-awesome.min.css",
"src/styles.css",
"./node_modules/primeng/resources/themes/omega/theme.css",
"./node_modules/primeng/resources/primeng.min.css",
"./node_modules/primeicons/primeicons.css"
],
"scripts": [
"./node_modules/jquery/dist/jquery.slim.min.js",
"./node_modules/popper.js/dist/umd/popper.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
]