Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
231 views
in Technique[技术] by (71.8m points)

android - 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...