Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228598

Ionic2 typescript project with cordova plugins

$
0
0

Hi,
anyone knows what I must do to make cordova plugins work on my ionic2 typescript project?

Following these steps...

ionic start myproject blank --v2 --ts

ionic platform add ios

ionic build

ionic serve

then, in my app.ts, inside platform ready function i try to set light style to StatusBar:

if(StatusBar) StatusBar.setStyle(StatusBar.LIGHT_CONTENT);

In my google chrome console appears this error (that's normal because i don't have cordova on browser):

EXCEPTION: ReferenceError: StatusBar is not defined

and in Terminal i can see this another error:

Cannot find name 'StatusBar'.

Same happens with all of my plugins. If I try to hide splashscreen, in my terminal appears:

Property 'splashscreen' does not exist on type 'Navigator'.

and if I use splashscreen plugin, for example, 5 times, this error appears 5 times too.

For debugging I use Google Chrome browser and ionic serve.
What I really want is to avoid the errors displayed on the terminal, because when I use 10 plugins 20 times (for example) I will see 200 errors every time I make a change on my .'ts' files. :astonished:

My system information:

Cordova CLI: 6.0.0
Gulp version: CLI version 1.2.0
Gulp local: Local version 3.9.1
Ionic Version: 2.0.0-alpha.57
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: 1.8.5
ios-sim version: 5.0.6
OS: Mac OS X El Capitan
Node Version: v4.2.6
Xcode version: Xcode 7.2.1 Build version 7C1002

ionic plugin ls:

cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.1 "Device"
cordova-plugin-network-information 1.2.0 "Network Information"
cordova-plugin-splashscreen 3.1.0 "Splashscreen"
cordova-plugin-statusbar 2.1.1 "StatusBar"
cordova-plugin-whitelist 1.2.1 "Whitelist"
ionic-plugin-keyboard 1.0.8 "Keyboard"

ionic platform ls

Installed platforms: ios 4.0.1

PD: Sorry for my bad english. :pensive:

Thanks in advance!


Viewing all articles
Browse latest Browse all 228598

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>