Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230271

How do we connect JavaScript file to ionic project

$
0
0

@siiulan Sorry for late response I have been quite busy this days!

Ok some things I noticed:

In the video:

He is creating just a index.html file and a app.js file. He is explaining that you need nothing else to use ionic. You can use ionic with pure html(index.hml) and vanilla javascript(app.js file).

If you can see he has no “project or app” structure because he is not using any framework at all.

In your code:

  1. You are using angular: It means you are using a framework to control the logic of your app insted of using vanilla javascript(though under the hood angular is using it for you) so there is no point for you to create the app.js file in there. use Angular.

  2. Inside your index.html you have no <script src=“long_url_here…”> on the top of your file in your header just like in this moment of the video https://youtu.be/r2ga-iXS5i4?t=4921
    Again this is because I believe you are using the home.page.html file generated by ionic for you. As you can see in your file you have no … on the top. Ionic and angular is handling all that in the background for you
    so that is why you dont see it on the top. The base structure of your app is handled in the index.html file in your project structure. Search for it in the bottom.

So what can you do? Simple:

  1. create a folder anywhere you want, not in the angular project. Could be in your desktop for exmaple: myApp

  2. create index.html file just like normal website and be sure to add ionic script sources on the header of your file and add code in there

  3. create app.js file and add code in there.

That should do the job.

Think about ionic for styling just like bootstrap or AngularMaterial.

Think about Angular or react or vuejs or vanillaJs as your project logic.

Hope it helps! Anything else let me know


Viewing all articles
Browse latest Browse all 230271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>