angular.module('starter.controllers', []) .controller('DashCtrl', function($scope,$ionicPopup) { $scope.preis=""; $scope.name=""; $scope.freitext=""; var showAlert=0; $scope.validate = function() { showAlert=0; if ($scope.name.length < 1){ showAlert=1; } if ($scope.freitext.length < 1){ showAlert=1; } if (showAlert==1){ $scope.showAlert(); } }; $scope.showAlert = function() { var alertPopup = $ionicPopup.alert({ title: 'Uuuupppsssiii', template: 'Bitte prüfe deine Eingaben.' }); alertPopup.then(function(res) { console.log('Thank you for not eating my delicious ice cream cone'); }); }; function buysuccessHandler (result) { inappbilling.consumePurchase(successHandler, errorHandler, "3xrose"); } function successHandler (result) { var strResult = ""; if(typeof result === 'object') { strResult = JSON.stringify(result); } else { strResult = result; } alert("SUCCESS: \r\n"+strResult ); } function errorHandler (error) { alert("ERROR: \r\n"+error ); } $scope.buyAdFree = function() { alert($scope.preis); if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") { inappbilling.buy(buysuccessHandler, errorHandler,"3xrose"); } } }) .controller('BuysCtrl', function($scope) { // With the new view caching in Ionic, Controllers are only called // when they are recreated or on app start, instead of every page change. // To listen for when this page is active (for example, to refresh data), // listen for the $ionicView.enter event: // //$scope.$on('$ionicView.enter', function(e) { //}); }) .controller('Dummy', function($scope) { });