New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add my own custom plugin with ionic v2 app #525
Comments
Same question here, is it even possible? |
Hey there, Yes you can add your custom plugin to Ionic 2. Since Ionic 2 uses TypeScript (by default) you might encounter some errors What you need to do is add a line at the top of the page to declare the That line will tell the IDE and the compiler to ignore any calls made to It's worth noting that when you use plugins this way, you need to wrap it Also, you can always submit an issue here to request a plugin to be added On Sep 3, 2016 2:42 AM, "DILEEP YADAV" notifications@github.com wrote: Hi! Team, I have one issue , How to add my own custom cordova plugin with ionic v2 — |
I have similar problem. I am not sure how to consume custom plugin in typescript (.ts) file. function PhoniroPlugin() { PhoniroPlugin.prototype.showToast = function(aString){ exec(function(result){ Now how to import this plugin in testpage.ts file |
I have not published this plugin. It's on my local machine. |
@dheerajsw no you don't need to publish it. In your For example, if I wanted to use the plugin I just linked, I need to do add |
I am new to this development. import { Component } from '@angular/core'; Please help me fix this issue. |
@dheerajsw yeah you also need to wrap you method with the following:
|
It worked. Thank you for helping in understanding how to consume plugins. |
How does it work? Uncaught ReferenceError: cordova is not defined that means cordova is not defined forever, then if you use the codes if (typeof cordova !== 'undefined') { the code2 will run everytime,!!!! |
@ihadeed Hi how does it work? If the cordova is undefined ,,,How could I run the cordova plugins?? |
@dheerajsw |
@dheerajsw The cordova plugin can not test in a browser! It only could run in a device or emulator~~ So in browser it will run code1 everytime, But run code2 in a emulator! Thank you for your help! |
Hi @maangcctv |
HI All Can you please guide me in writing the ionic custom plugin, i have written native iOS - ObjectiveC++. Thanks in advance |
The declaration of In my Ionic v1 I was ensuring proper image/DIV sizing based on total screen size, to get this I was using:
How do I convert this to Ionic v2? |
Getting the same issue.
Wrapped the code into the Please help. |
Hi! Team,
I have one issue , How to add my own custom cordova plugin with ionic v2 app.
would you any one suggest me.
The text was updated successfully, but these errors were encountered: