无法找到从模板链接的样式表文件'css/style.css',将 Bootstrap 与Angular连接时遇到此错误

aiazj4mn  于 2023-03-24  发布在  Bootstrap
关注(0)|答案(1)|浏览(135)
<link rel="stylesheet" href="plugins/bootstrap/bootstrap.min.css">

<link rel="stylesheet" href="plugins/owl-carousel/owl.carousel.css">
<link rel="stylesheet" href="plugins/magnific-popup/magnific-popup.css">
<link rel="stylesheet" href="css/style.css">

这是通过我的错误代码的一部分,就像css我得到的所有插件,如引导错误,owl-carousel,magnificent-popup

zxlwwiss

zxlwwiss1#

您可以将所有CSS文件移动到src/assets/css/中,然后将这些代码添加到angular.json中

"styles": [
      "src/assets/css/style.css",
      "src/assets/css/plugins/owl-carousel/owl.carousel.css",
      "src/assets/css/plugins/magnific-popup/magnific-popup.css",
    ]

这可以解决问题。
另一种解决方案可能会有所帮助:在文件***login.component.ts***中添加

styleUrls: ['./login.component.css', './Your-Path/Your-File.css']

相关问题