我在使用 angular2、angular-cli@webpack 和 primeng 的入门项目中遇到以下错误。 PrimeNG 中唯一的 ui 组件是一个下拉菜单,它可以呈现并且它有自己的值,但从来没有应用过 css 主题。(请参阅下面有关 CSS 的错误)。我不确定为什么会出现此错误并且花了无数个小时没有结果,所以此时我不知所措。组件是用 ng 命令生成的,ng serve 运行 web 服务器。有人知道吗?我也尝试过 node.js 6.5.0 和 4.5.0(使用 nvm 切换和管理它们)。
非常感谢任何帮助。
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/node_modules/primeng/resources/primeng.min.css Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/src/app/resources/css/font-awesome-4.6.3/css/font-awesome.min.css Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/node_modules/primeui/primeui-ng-all.min.css Failed to load resource: the server responded with a status of 404
顺便说一句,现在我将代码发布在:https://github.com/GregHila/primeng-angular-cli .
最佳答案
在src/
下应该有一个文件styles.css
。我认为您可以在此处导入样式。
例如:
@import '../node_modules/primeng/resources/primeng.min.css';
另一种方法是在 styles
数组中的 angular-cli.json
文件中提及它们。
关于node.js - 带有 primeng 404 问题的 angular-cli@webpack,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39462402/