angular.module('starter.controllers', []) .controller('DashCtrl', function($scope,$ionicPopup,$http) { $scope.preis=""; $scope.name=""; $scope.freitext=""; $scope.validate = function() { var link = 'http://api.raataar.de/rosen/vorschau.php'; $http.post(link, {name : $scope.name, freitext: $scope.freitext, rosen: $scope.preis}).then(function (res){ $scope.response = res.data; window.open($scope.response, '_system', 'location=yes'); return false; }); }; function buysuccessHandler (result) { inappbilling.consumePurchase(successHandler, errorHandler, $scope.preis); } 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, $scope.preis); } } }) .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) { });