2016-09-28 39 views
0

我使用的離子2.錯誤TS2339:房產 '診斷' 的類型不存在 'CordovaPlugins'

我跟着this,並做了以下內容:

cordova plugin add cordova.plugins.diagnostic 
npm install -g typings 
typings install dt~cordova --save --global 

app.ts

if (window.cordova && cordova.plugins) { 
     cordova.plugins.diagnostic.isLocationEnabled(function (enabled) { 
     alert("Location is " + (enabled ? "enabled" : "disabled")); 
     }, function (error) { 
     alert("The following error occurred: " + error); 
     }); 
    } 
    } 

我得到以下錯誤:

error TS2339: Property 'diagnostic' does not exist on type 'CordovaPlugins'.

我注意到window.cordovaundefined

如果有人能告訴我如何讓科爾多瓦插件工作,我將不勝感激。

感謝

回答

0

所以對於離子2,儘量到位cordova.plugins窗口[ '插件'。

相關問題