因为ionic2是基于typescript的,需要编译,在ts文件中直接使用会报错,
比如使用toast插件:
window.plugins.toast.showShortCenter(msg)
会报错:
Property 'plugins' does not exist on type 'Window'.
解决方法:
(<any>window).plugins.toast.showShortCenter(msg);
即window改为(<any>window)。
因为ionic2是基于typescript的,需要编译,在ts文件中直接使用会报错,
比如使用toast插件:
window.plugins.toast.showShortCenter(msg)
Property 'plugins' does not exist on type 'Window'.
解决方法:
(<any>window).plugins.toast.showShortCenter(msg);
即window改为(<any>window)。