【发布时间】:2015-12-11 10:14:19
【问题描述】:
我是 Ionic 和 Cordova 的新手。我正在尝试添加一个插件
1.使用"ionic start myproj"创建了一个离子应用
2.使用以下评论添加了一个cordova插件
cordova plugin add https://github.com/domaemon/org.apache.cordova.plugin.helloworld.git
3.在ionic app.js中添加navigator.helloworld.say();如下所述
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleLightContent();
}
navigator.helloworld.say();
});
})
当我通过“离子服务”运行代码时..我没有收到 hello 警报,但我在控制台中收到以下错误,如下所示
" 无法读取行 navigator.helloworld.say();
的未定义属性 'type'请让我知道我是否需要在任何 xml 中添加任何条目以手动添加插件,或者我是否遗漏了什么?
【问题讨论】:
-
您没有导航器,因为您是在浏览器中测试您的应用程序。
标签: cordova ionic-framework ionic cordova-plugins