Use .js file inside home.html of Ionic 3 (PLEASE help!)


#1

Hello guys,

I have a personally built javascript file, not a javascript library.
This javascript file requires other library and I installed that library in Ionic 3.

How can I possibly use this javascript file inside home.html of Ionic 3?
I tried to copy and paste its content inside script tag on html file but NOTHING worked…
I tried to copy and paste this on home.ts and it didn’t work and shows me many errors. I don’t know how to convert this js file into typescript. I don’t believe typescript code will work for this library which is based on javascript.

Is there any way to properly link this personal .js file into home.html and make it properly function like on normal html?
It works fine on a normal html file… but not on Ionic 3. Should I use older version Ionic (1 or 2) for better compatibility with Javascript? I know older Ionic versions are based on javascript. I’m just trying to make 100 lines of javascript work which is a joke on normal HTML. I wonder why Ionic developers made it so difficult to use normal javascript on version 3 when there are more useful javascript libraries than typescript?

Anyways, please help me out. I’m struggling with this issue a whole day!

Thanks in advance.


#2

Hi

beyond the proper way of including third party libs (js) in Ionic as documented in http://ionicframework.com/docs/developer-resources/third-party-libs/, I think the only valid place to do a script-include is index.html. Trying to include in individual page html is probably useless as Angular doesn’t like this. And if you insist, I think you need to include the javascript code in a TS file and wrap it as a function, or better, make it a provider.

Regards

Tom


#3

Don’t open multiple topics about the same problem, this is wasting our time.


#4