85 lines
1.9 KiB
JavaScript
85 lines
1.9 KiB
JavaScript
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 successBuyHandler (result) {
|
|
var strResult = "";
|
|
if(typeof result === 'object') {
|
|
strResult = JSON.stringify(result);
|
|
} else {
|
|
strResult = result;
|
|
}
|
|
alert("SUCCESS: \r\n"+strResult );
|
|
}
|
|
|
|
function successConsumeHandler (result) {
|
|
var strResult = "";
|
|
if(typeof result === 'object') {
|
|
strResult = JSON.stringify(result);
|
|
} else {
|
|
strResult = result;
|
|
}
|
|
alert("SUCCESS: \r\n"+strResult );
|
|
}
|
|
|
|
function errorBuyHandler (error) {
|
|
alert("ERROR: \r\n"+error );
|
|
}
|
|
|
|
function errorConsumeHandler (error) {
|
|
alert("ERROR: \r\n"+error );
|
|
}
|
|
|
|
|
|
function buysuccessHandler (result) {
|
|
inappbilling.consumePurchase(successConsumeHandler, errorConsumeHandler, $scope.preis);
|
|
}
|
|
|
|
$scope.buyRose = function() {
|
|
|
|
//alert($scope.preis);
|
|
|
|
if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") {
|
|
inappbilling.buy(successBuyHandler, errorBuyHandler, $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) {
|
|
});
|