Using ngCordova: "Can't find variable Camera"

Hi,

Using ngCordova, I followed the code of the blog: https://blog.nraboy.com/2014/09/use-android-ios-camera-ionic-framework/

When execute the code, I have the following error: “Error: Can’t find variable: Camera”

Is Camera a variable that I should initialise somewhere ?

in my app.js I have :
var app = angular.module(‘starter’, [‘ionic’, ‘pouchdb’, ‘ngCordova’])

and the index.html

1 Like

The variable Camera is added by installing the camera plugin:

ionic plugin add org.apache.cordova.camera

What I did before was : cordova plugin add org.apache.cordova.camera
I correctly my plugins a folder named: org.apache.cordova.camera

I executed the command: ionic plugin add org.apache.cordova.camera
I got the message: Plugin “org.apache.cordova.camera” already installed on ios.

Do I manually have to add the plugins/org.apache.cordova.camera/Camera.js in my index.html file ?

I am testing via the safari browser of an iphone and a webserver on my Desktop. I also noticed that cordova.js was not found

To be able to use camera, should I compile first and execute it as a standalone application on the iphone ? If so, is it the only way to test the camera functionality ?

Cordova.js is not available in the browser, cause its not needed. You don’t have access to native features like the camera in the browser, simply because they aren’t there.

Native features won’t work in the browser (aside a few exceptions that are implemented in browser engines, like geolocation)

Your last statement is partially right. If you want to test the native features, you’ll have to package your application in PhoneGap on your phone, or use an emulator on your computer and make use of the ionic emulate ios command.

This is a very old thread. Is it still the case ? (according to https://github.com/apache/cordova-plugin-camera, the browser is supported. )