离子框架/Cordova 相机 [英] Ionic Framework / Cordova Camera

查看:25
本文介绍了离子框架/Cordova 相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Ionic/Cordova Android 开发者的新手.最近几天我一直在尝试安装cordova相机插件但没有结果.请帮帮我.

我想要做的是当你滑动到某个幻灯片时,相机被加载并且用户能够拍照.(像 snapchat)

  1. 如何让相机已加载?我看到的所有示例都必须单击一个按钮才能加载相机.

  2. 如果我尝试这些例子,我就会得到

<块引用>

未捕获的 ReferenceError: require 未定义

cordova.js 中这一行的错误

<块引用>

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

我正在使用 $ionicPlatform.ready() 函数来替换 deviceready 函数.这是可行的吗?

对于这个特定问题,我真的没有太多代码.但是如果你想看的话,我会更新的.

谢谢!

解决方案

您似乎缺少 requireJS.使用 npm install -g requirejs 通过 nodejs 安装

我相信这会有助于为您解决问题.

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

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

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

这篇关于离子框架/Cordova 相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆