It's getting hard to see documents or examples now that Ionic 2 is out.
I want to use ionic.native.js
in the old Ionic V1 project.
Thing is that the installation is with npm
npm install ionic-native --save
But now I have tons of npm
modules under node_modules/
as a dependency. Ionic documentation say:
If you are using Angular 1.x or plain ES5 JavaScript, you need to add ionic.native.js to your index.html
but they don't give example on "how" to place it in the index.html
- and that is my question.
Currently my file is located in:
> find . -name ionic.native.js
./node_modules/ionic-native/dist/ionic.native.js
There's no gulp task for the node_modules/
dir ... so how do I import it into index.html
? or maybe I used the npm command in the wrong place ? ( currently it's in the root dir of the project, where gulpfile.js
lives )
I was having the same problem as you.
In the end, what ended up solving it was using:
bower install ionic-native --save
This adds the files to the lib/ directory, which is accessible from the index page.
Then in the index.html file, add:
<script src="lib/ionic-native/ionic.native.js"></script>
Hopefully this helps!
If you want to use npm
instead of bower
, you can add a path to desired location when installing the plugin:
npm install ionic-native --save --prefix www/lib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With