Ionic Framework / Cordova Camera

I'm new to Ionic / Cordova Android dev. I've been trying to put in cordova camera plugin for last few days with no outcomes. Please help me out.

What I want to do is when you slide to a certain slide, the camera is loaded and the user is able to take the picture. (Like snapchat)

  1. How do I have the camera already loaded? All the examples I saw had to click a button to load camera.

  2. If I try the examples, I get

Uncaught ReferenceError: require is not defined

error for this line in cordova.js

var channel = require('cordova/channel');

I'm using $ionicPlatform.ready() function to replace deviceready function. Is this something viable?

I don't really have much of code for this specific problem. But if you want to see it, I will update it.

Thank you!

You seems to missing the import for the require lib.

http://requirejs.org/ you can use the CDN //cdnjs.cloudflare.com/ajax/libs/require.js/2.1.11/require.min.js

Just include

<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.11/require.min.js"></script>

BEFORE you import the cordova.js.

HTH

You seem to be missing requireJS. Use npm install -g requirejs to install it via nodejs

I believe this would be helpful in sorting things out for you.

https://cordova.apache.org/docs/en/3.0.0/cordova_camera_camera.md.html

https://github.com/azizimusa/phonegap-demo