Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49101

Cordova-plugin-camera not working

$
0
0

@Keertesh wrote:

Continuing the discussion from Cordova Camera Plugin Not Working w/ AngularJS:

I'm using VS 2015 so i installed the plugin directly within the IDE in config.xml
I'm new to angular.
services.js

.factory('Camera', function ($q) {

    return {
        getPicture: function (options) {
            var q = $q.defer();

            navigator.camera.getPicture(function (result) {
                q.resolve(result);
            }, function (err) {
                q.reject(err);
            }, options);

            return q.promise;
        }
    }

})

controller.js

   $scope.takePicture = function (options) {

            var options = {
                quality: 75,
                targetWidth: 200,
                targetHeight: 200,
                sourceType: 1
            };

            Camera.getPicture(options).then(function (imageData) {
                $scope.picture = imageData;
            }, function (err) {
                console.log(err);
            });

        };

myPage.html

 <a class="button button-full  ion-ios-camera button-outline button-royal" ng-click="takePicture()" >

                            </a>

Posts: 11

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49101

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>