Include js file


Playing around with the ionic framework (v4.3.0) a couple of days now and am banging my head on something I think should be very simple.

How do I include js files to specific pages?

If I create a new page, I automatically get a .scss file. Shouldn’t there be a js file as well?
I did try adding some files in the assets folder and loading them through the index. Works okay, but is not what I’m after.

Any suggestions are very welcome…

It doesn’t make JS file on it’s own when you do ionic generate page some_page. What are you trying to achieve with the JS file anyway? All business logic goes inside .ts file.

Well, I’m building a simple app with a splashpage. This splashpafe should automatically redirect to the next page. So I was planning on adding this redirect through js.
Perhaps I made a mistake by thinking I need separate js files for this… will have a look at adding scriptlets to the .ts file…

Yes, that was what I was looking for

ok, for redirection, you first initialize an instance of NavController, say nav in the constructor of your class in the .ts file. Then you could simply do this.nav.push(YourPageName); or this.nav.setRoot(YourPageName);, however you like.