【发布时间】:2016-07-17 16:24:13
【问题描述】:
我在我的 ionic2 项目中安装了 x-toaster 插件:
cordova plugin add cordova-plugin-x-toast --save
在我尝试的代码中:
window['plugins'].toast.show(message, "short", position);
上面似乎没有得到插件。
我的组件:
constructor(
public navController: NavController,
private formBuilder: FormBuilder,
private goalService: GoalService,
private authService: AuthService,
private navService: NavService,
public platform: Platform
) {
super()
this.contractForm = formBuilder.group({
termsAccepted: [false, Validators.required],
})
}
showToast(message, position) {
this.platform.ready().then(() => {
window['plugins'].toast.show(message, "short", position);
});
}
【问题讨论】:
-
定义“以上都不起作用”。 什么不起作用?任何错误信息?到目前为止,您尝试过什么?
-
查看更新截图
-
我需要以某种方式导入或注入那个cordova插件吗?
-
见下面的答案,但它确实显示了烤面包机。但是..没有更多的控制台错误..
标签: cordova angular cordova-plugins ionic2