This commit is contained in:
Lorenzo Iovino 2016-01-30 22:32:14 +01:00
parent 9d351bb809
commit 9dcb7f65d0
5 changed files with 35 additions and 19 deletions

View file

@ -53,4 +53,4 @@
"ios",
"android"
]
}
}

View file

@ -23,8 +23,9 @@
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="lib/angular-youtube-mb/dist/angular-youtube-embed.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives.js"></script>

View file

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

View file

@ -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":

View file

@ -4,7 +4,7 @@
</ion-nav-title>
<ion-content>
<input type="text" placeholder="Search" ng-hide="categoryId=='settings'">
<input type="text" placeholder="Search" ng-hide="categoryId=='settings'" ng-hide="categoryId=='addticketwithphoto'">
<div class="list category-homes">
@ -24,6 +24,16 @@
</a>
</div>
<div class="form-group padding-top" ng-show="categoryId=='addticketwithphoto'">
<button class='button button-positive' data-ng-click="takePicture()">
{{text.buttonTitle}}
</button>
</div>
<div class="item item-image" ng-show="categoryId=='addticketwithphoto'">
<img ng-src="{{cameraPic}}"/>
</div>
<ul class="list" ng-show="categoryId=='settings'">
<div class="item item-divider">TOGGLE</div>