问题描述
我在Angular中构建了一个Ionic应用程序,并且ave从来没有能够使插件工作。
作为一个例子,我已经尝试使用状态栏插件描述如下:
但它仍然显示在我的应用程序中。我试过:
$ cordova plugin add org.apache.cordova.statusbar
然后是cordova prepare,ionic run ios,还是没有运气。
我键入
时列出的插件 $ cordova插件列表
com.ionic.keyboard 1.0。 2Keyboard
org.apache.cordova.console 0.2.10Console
org.apache.cordova.device 0.2.11Device
org.apache.cordova.statusbar 0.1 .7StatusBar
我也使用Gulp。我有一个文件夹与我所有的dev工作,gulp移动和编译它到一个/ dist文件夹从提供服务。我很确定插件是完全移动,有什么地方我应该检查引用?
任何想法,如果你需要做一些事情,以使用Cordova插件与Ionic?
这个答案是我必须添加
< script src =cordova .js>< / script>
到我的页面,就在脚本上方。
请注意,这个文件在开发过程中不存在,它在运行时注入...这就是为什么我可以解决它。希望这有助于某人!
I am building out an Ionic app in Angular and ave never been able to get plugins to work.
As an example, I have tried using the statusbar plugin as described here:
http://ionicframework.com/tutorials/fullscreen-apps/
But it still shows in my app. I tried:
$ cordova plugin add org.apache.cordova.statusbar
and then "cordova prepare", "ionic run ios" and still no luck.
The plugins I get listed when I type
$ cordova plugin list
com.ionic.keyboard 1.0.2 "Keyboard"
org.apache.cordova.console 0.2.10 "Console"
org.apache.cordova.device 0.2.11 "Device"
org.apache.cordova.statusbar 0.1.7 "StatusBar"
I also am using Gulp. I have a folder with all my dev work in, and gulp moves and compiles it into a /dist folder from whence it is served. I'm pretty sure the plugins are moved across perfectly, is there anywhere I should check the references?
Any ideas if there is something you have to do in order to use Cordova plugins with Ionic?
The answer to this was that I had to add
<script src="cordova.js"></script>
to my page, just above my scripts.
Please be aware this file doesnt exist during development, it's injected at runtime... which is why I could solve it. Hope this helps someone!
这篇关于Cordova插件不能与Ionic一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!