Reputation: 96
I want to use this plugin in my app plugin cordova-vk
but I can't connect it to typescript.
vkSdk is not defined
I understand that it does not locate the plugin. He is in the node_modules folder. How do I connect it to my page? And use his methods.
I tried to prescribe
declare let cordovaVk : any;
but it didn't help. I know I'm doing something wrong. But I can't figure out what it was. I'm using the latest versions of Cordova and Ionic since I just started the project
Upvotes: 0
Views: 245
Reputation: 29614
According to the plugin.xml of the specified plugin:
<js-module src="www/vksdk.js" name="VkSdk">
<clobbers target="VkSdk" />
</js-module>
The global variable is VkSdk
.
In your ts file declare it immediately below the import statements.
declare var VkSdk:any;
Also while calling the plugin, make sure it is inside platform.ready()
this.platform.ready().then(()=>{
VkSdk.init('123456');//from the plugin docs
})
Also Cordova plugins need to be tested in a device or emulator.. cordova is not supported in Ionic serve
Upvotes: 1