Giter Site home page Giter Site logo

Comments (9)

ihadeed avatar ihadeed commented on May 12, 2024

I don't see any minified JS in the package. I'm afraid you would have to minify it yourself for now.

from awesome-cordova-plugins.

suwarno-ong avatar suwarno-ong commented on May 12, 2024

Yes, I try to self-help using gulp.

var typescript = require('gulp-tsc');
var concatJs = require('gulp-concat');
var uglifyJs = require('gulp-uglify');
var rename = require('gulp-rename');

var paths = {
  typescript: ['src/**/*.ts'],
};

gulp.task('compile', function(done) {
  gulp.src(paths.typescript)
    .pipe(typescript({ emitError: false }))
    .pipe(concatJs('ionic-native.js'))
    .pipe(gulp.dest('dist'))
    .pipe(uglifyJs())
    .pipe(rename({ extname: '.min.js' }))
    .pipe(gulp.dest('dist'))
    .on('end', done);
});

Perhaps there is a sequence requirement when concatenating the ts file.
I hit errors like require is not defined, so I try to add require.js
Then i hit Module name "ng1" has not been loaded yet for context: _. Use require([])

Anyone can share how you concat and minify ionic-native to a single js file?

from awesome-cordova-plugins.

ihadeed avatar ihadeed commented on May 12, 2024

@deepslux are you using Ionic 2?

If so, you do not need to import any JS files to your index.html. You also wouldn't need to minify anything.

Importing the plugin you need in your TypeScript files (import {Camera} from 'ionic-native';) will result in the needed code to be compiled in your app bundle JS file.

from awesome-cordova-plugins.

suwarno-ong avatar suwarno-ong commented on May 12, 2024

@ihadeed I'm using Ionic 1. Is this repo meant for Ionic 2? Or anything I need to do to use it in Ionic 1?

from awesome-cordova-plugins.

ihadeed avatar ihadeed commented on May 12, 2024

@deepslux I haven't tested it personally. But looking at the code it looks like the Angular 1 usage would be by importing the ngCordova module in your main app module. Then calling methods like ngCordova.Camera.getPicture().then(....

The methods are also exposed in the variable window.IonicNative.

I wrote a little article explaining the various way of using Ionic Native, but again I haven't really tested it. Hence, why I haven't officially published the article. But you can have a look here: http://jsdev.ca/ionic-native-cordova-plugins-simplified/

from awesome-cordova-plugins.

seeps001 avatar seeps001 commented on May 12, 2024

@deepslux did you manage to get ionic-native working with Ionic 1? I'm having issues setting things update. I've installed ionic-native, but now need to include ionic.native.js in my index.html, but having issues with the path.

from awesome-cordova-plugins.

seeps001 avatar seeps001 commented on May 12, 2024

@ihadeed Could you please assist, how should ionic-native be included in index.html. I'm having issues with referencing the correct path to ionic.native.js. I'm using Ionic 1.

from awesome-cordova-plugins.

pabloleone avatar pabloleone commented on May 12, 2024

This issue shouldn't be closed! It is not clear how to import the library when working with AngularJS 1.x

ngCordova (last reply) is not a valid answer as it doesn't exist anymore.

The import keyword in the JS files is not supported and there's no native import. We need to know which files to include in the index.html and the order they should be added.

Thank you.

from awesome-cordova-plugins.

ihadeed avatar ihadeed commented on May 12, 2024

@pabloleone

Please open a new issue with any questions that you have.

Currently there is no ES5 files exported in the Ionic Native package. It is still compatible with AngularJS 1.x but you need something to transform it from ES2015 to ES5 (Babel, Webpack, Rollup...etc).

ngCordova doesn't exist anymore, we export it under the ionic.native module. See https://unpkg.com/@ionic-native/[email protected]/ng1.js

from awesome-cordova-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.