From 9dcb7f65d006b5c1833701188ab6205152ce103f Mon Sep 17 00:00:00 2001 From: Lorenzo Iovino Date: Sat, 30 Jan 2016 22:32:14 +0100 Subject: [PATCH] gre --- hackatonApp/package.json | 2 +- hackatonApp/www/index.html | 5 +++-- hackatonApp/www/js/app.js | 14 -------------- hackatonApp/www/js/controllers.js | 21 ++++++++++++++++++++- hackatonApp/www/views/app/category.html | 12 +++++++++++- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/hackatonApp/package.json b/hackatonApp/package.json index f0ea8e8..c1ed6c0 100644 --- a/hackatonApp/package.json +++ b/hackatonApp/package.json @@ -53,4 +53,4 @@ "ios", "android" ] -} \ No newline at end of file +} diff --git a/hackatonApp/www/index.html b/hackatonApp/www/index.html index 99444ba..a7d5ec2 100644 --- a/hackatonApp/www/index.html +++ b/hackatonApp/www/index.html @@ -23,8 +23,9 @@ - - + + + diff --git a/hackatonApp/www/js/app.js b/hackatonApp/www/js/app.js index a15ff2b..4fbf597 100644 --- a/hackatonApp/www/js/app.js +++ b/hackatonApp/www/js/app.js @@ -1,19 +1,5 @@ // Ionic Starter App -function takePicture() - { - console.log("PSOO"); - navigator.camera.getPicture(function(imageURI) { - - // imageURI is the URL of the image that we can use for - // an element or backgroundImage. - - }, function(err) { - - // Ruh-roh, something bad happened - - }, cameraOptions); - } angular.module('underscore', []) .factory('_', function() { return window._; // assumes underscore has already been loaded on the page diff --git a/hackatonApp/www/js/controllers.js b/hackatonApp/www/js/controllers.js index 37f8dd6..6ee2b05 100644 --- a/hackatonApp/www/js/controllers.js +++ b/hackatonApp/www/js/controllers.js @@ -14,6 +14,26 @@ angular.module('your_app_name.controllers', []) $scope.user.telephone="3477608470"; $scope.user.picture="img/laura.jpg"; $scope.user.score="15463"; + $scope.takePicture = function(){ + var cameraOptions = { + quality: 50, + destinationType: Camera.DestinationType.DATA_URL + }; + var success = function(data){ + $scope.$apply(function () { + /* + remember to set the image ng-src in $apply, + i tried to set it from outside and it doesn't work. + */ + $scope.cameraPic = "data:image/jpeg;base64," + data; + }); + }; + var failure = function(message){ + alert('Failed because: ' + message); + }; + //call the cordova camera plugin to open the device's camera + navigator.camera.getPicture( success , failure , cameraOptions ); + }; @@ -544,7 +564,6 @@ angular.module('your_app_name.controllers', []) { case "addticketwithphoto": { - takePicture(); break; } case "booking": diff --git a/hackatonApp/www/views/app/category.html b/hackatonApp/www/views/app/category.html index d109f01..0f11525 100644 --- a/hackatonApp/www/views/app/category.html +++ b/hackatonApp/www/views/app/category.html @@ -4,7 +4,7 @@ - +
@@ -24,6 +24,16 @@
+
+ +
+ +
+ +
+