javascript - 在 Ionic-Angular 上, bower 组件已被忽略

标签 javascript angularjs cordova ionic-framework bower

我正在尝试使用 Cordova 插件,我安装了 bower,但在浏览器控制台中收到错误消息: 获取 http://localhost:8100/bower_components/ngCordova/dist/ng-cordova.js 这是文件结构

enter image description here

在这里,这是我的 index.html

中的内容
<script src="bower_components/ngCordova/dist/ng-cordova.js"></script>

最佳答案

文件只能在www 中加载目录。默认情况下,Ionic 将 bower 包安装到 www/lib 中目录。

$ ionic add ngCordova在 CLI 中从您的项目根目录运行它。

这会将 ngCordova 安装到正确的目录中。然后在此路径添加脚本。

<script src="lib/dist/ng-cordova.js"></script>

关于javascript - 在 Ionic-Angular 上, bower 组件已被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29734464/

相关文章:

javascript - jQuery-Datatables 下拉列表仅适用于某些列

javascript - 为什么在浏览器中使用 ES6

android - Crosswalk 无法解析配置 ':_armv7DebugCompile' 的所有依赖项

javascript - 使用 ChartJS 更新图表 - VueJS

javascript - 如何创建 JavaScript 条件来显示视频的图像预览或图片的图像预览?

javascript - AngularJS 下拉列表和文本框过滤器

javascript - 使用热键根据快捷键触发按钮点击事件

javascript - 无法在 Angular JS Promise 中抛出错误

javascript - 我如何从 PhoneGap camera.getPicture 获取文件对象?

cordova - 在 Phonegap Build App (iOS/Android) 中打开外部链接