angular5 - Owl Carousel 2 不适用于 Angular 5
问题描述
我需要将 OwlCarousel2 与 Angular5 一起使用,并且我正在使用https://www.npmjs.com/package/ngx-owl-carousel但其显示错误请参见下图以供参考。任何帮助,将不胜感激。
解决方案
从您的屏幕截图来看,这不是猫头鹰轮播问题。它发生在您的应用程序组件文件中未包含 jquery。
所以使用以下命令安装
npm install jquery — save
在 .angular.json 文件中添加 jquery 文件
“scripts”: [ “../node_modules/jquery/dist/jquery.min.js” ]
然后在 app.component.ts 文件中按如下方式导入。
import * as $ from ‘jquery’;
那么现在你可以使用errors了。
笔记:-
如果你想在你的应用程序中使用 bootstrap,或者如果你已经在你的项目中使用了,请确保在包含 bootstrap javascript 文件之前包含 jQuery,如下所示。由于 bootstrap 的 javascript 文件需要 jQuery。
“scripts”: [ “../node_modules/jquery/dist/jquery.min.js”,
“../node_modules/bootstrap/dist/js/bootstrap.js”]
这是两个链接,提供了在您的应用程序中导入 jquery 的一些想法。
请尝试一次并告诉我。
我希望它能解决你的问题。
推荐阅读
- c# - 我正在使用 ASP.NET MVC。我试图将 2 个模型加入 1 个 viewModel。调试过程中没有错误,但仍然无法将我的输出放入视图 cshtml
- json - 带有多个 select 语句和一个数组的 jq
- html - 如何将图像的中心固定在一个位置以进行动画?
- puppeteer - 如何单击具有属性的 p 元素
- java - 设置类中字段的持续时间
- python - 我如何为基于其他列名的空列添加值
- php - 在php中的浏览器中按下后退按钮时清除缓存
- python - 显示错误数字的 GEO 地图
- python - 在没有熊猫的情况下在python中切割具有上限和下限的numpy矩阵行
- c# - 订购 NodaTime 可为空的 OffsetDateTime