user3592221
user3592221

Reputation: 71

How to include external JS lib in Ionic/Cordova

I'm actually building an app using ionic and Cordova. I got a library, that I want to use in my app. It is an external JS lib, and I don't know how to include it in my project : Git-Hub Surely into lib folder and how to include the code & Controller & js file and How to call it ?

Cheers..

Upvotes: 1

Views: 891

Answers (1)

devqon
devqon

Reputation: 13997

The library you mentioned supports bower, so I would suggest going to your application directory, then run (in a cmd):

bower install client-oauth2 --save

It then installs the library in www/lib.

Then go to your index.html and just include the js file:

<!-- include this library before your app.js and other files you're using it -->
<script src="lib/client-oauth2/client-oauth2.js></script>

Upvotes: 1

Related Questions