Has anyone successfully integrated any custom directives into their ionic-RC0 app yet?
I’m currently using SignaturePad. I used to have the below code in one of my components:
@Component({
directives: [SignaturePad]
})
After upgrading to RC0, the problem is that (I believe) directives has been deprecated in @Component, and now we’re supposed to declare any new custom directives in app.module.ts, like below:
The thing is, this doesn’t actually work as intended, despite this being the answer I saw on stackoverflow. It works if I run my app in the web browser, but if I do ionic build ios, I get the following error in my Terminal:
ngc error: Error: Unexpected value 'SignaturePad' declared by the module 'AppModule'
Any help on how to integrate Custom Directives/SignaturePad is greatly appreciated!
Sorry, I looked at my code and it looks like I actually do have schemas instead of schema. I’ll modify my question details so that there’s no confusion later on.
I’ll take a look at your link and see if that helps!
So, I had to stop using angular2-signaturepad for now and just use the signature_pad.min.js library that it’s wrapped around; until angular2-signaturepad is able to support AoT compiling (which I believe was why the ngc compiler couldn’t compile SignaturePad.)
So, I ended up doing the following:
Import <script type="text/javascript" src="assets/js/signature_pad.min.js"></script> in index.html
In the .ts file that I used the SignaturePad on, I put the following:
ionViewDidEnter() {
let canvas = document.getElementById('signature-pad');
this.signaturePad = new SignaturePad(canvas);
}
In the same .ts file at line #1, I put the following (the TS won’t compile without this):
I believe that’s all I needed to do in order to make it work. Let me know if that helps or if you have any questions (it’s possible I might’ve forgot about a step :D)
But I prefer not doing it this way and using the angular2-signaturepad library instead like I did previously, but I couldn’t figure out a workaround in a reasonable amount of time
Basically my situation was that I was using my custom component which was giving error and the solution from the link helped me. (your situation may be different but this solution may or may not help you)