error TS2339: Die Eigenschaft 'diagnostic' existiert nicht für den Typ 'CordovaPlugins'
Ich benutze Ionic 2.
Ich folgteDie und tat Folgendes:
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);
});
}
}
Ich erhalte den folgenden Fehler:
error TS2339: Property 'diagnostic' does not exist on type 'CordovaPlugins'.
Ich bemerke, dasswindow.cordova
istundefined
.
Wenn jemand raten kann, wie ich das Cordova Plugin zum Laufen bringen kann, würde ich es begrüßen.
Vielen Dan