且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Angular 6-拒绝应用'...'中的样式,因为它的MIME类型('text/html')不支持

更新时间:2021-09-23 03:27:55

经过一番摸索,找到了答案(至少对我有用)

Found the answer (at least worked for me), after some digging around:

像inAngular 6一样,我们需要将所有外部CSS(例如bootstrap,fontawesome,Primeng等)包括到angular.json中,如下所示:

Looks like inAngular 6 we need to include any external CSS (like bootstrap, fontawesome, Primeng etc.,) to the angular.json as below:

        "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"
        ]