107 lines
No EOL
3.1 KiB
JavaScript
107 lines
No EOL
3.1 KiB
JavaScript
angular.module('app.controllers', [])
|
|
|
|
.controller('gemstoneCtrl', ['$scope', '$stateParams', 'Gemstone', '$ionicPopup', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
|
|
// You can include any angular dependencies as parameters for this function
|
|
// TIP: Access Route Parameters for your page via $stateParams.parameterName
|
|
function ($scope, $stateParams, Gemstone, $ionicPopup) {
|
|
|
|
$scope.colorState = {
|
|
'red':0,
|
|
'green':50,
|
|
'blue':50
|
|
}
|
|
|
|
$scope.emerald = function(){
|
|
var readyEvent = {
|
|
"type": "ready",
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
|
console.log(this.value + " button click");
|
|
var clickEvent = {
|
|
"type": "click",
|
|
"data": "Emerald"
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
|
|
|
$ionicPopup.alert({
|
|
title: 'Gem has been created!',
|
|
template: 'Your response has been recorded.'
|
|
});
|
|
}
|
|
|
|
$scope.ruby = function(){
|
|
var readyEvent = {
|
|
"type": "ready",
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
|
console.log(this.value + " button click");
|
|
var clickEvent = {
|
|
"type": "click",
|
|
"data": "Ruby"
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
|
|
|
$ionicPopup.alert({
|
|
title: 'Gem has been created!',
|
|
});
|
|
}
|
|
|
|
$scope.ruby = function(){
|
|
var readyEvent = {
|
|
"type": "ready",
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
|
console.log(this.value + " button click");
|
|
var clickEvent = {
|
|
"type": "click",
|
|
"data": "Ruby"
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
|
|
|
$ionicPopup.alert({
|
|
title: 'Gem has been created!',
|
|
});
|
|
}
|
|
|
|
$scope.sapphire = function(){
|
|
var readyEvent = {
|
|
"type": "ready",
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
|
console.log(this.value + " button click");
|
|
var clickEvent = {
|
|
"type": "click",
|
|
"data": "Sapphire"
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
|
|
|
$ionicPopup.alert({
|
|
title: 'Gem has been created!'
|
|
});
|
|
}
|
|
|
|
$scope.updateColor = function(){
|
|
|
|
}
|
|
|
|
$scope.custom = function(){
|
|
|
|
var readyEvent = {
|
|
"type": "ready",
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
|
|
|
var clickEvent = {
|
|
"type": "customColorClick",
|
|
"data": JSON.stringify($scope.colorState);
|
|
};
|
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
|
|
|
$ionicPopup.alert({
|
|
title:'Sent this color '+JSON.stringify($scope.colorState)
|
|
});
|
|
}
|
|
|
|
|
|
}])
|
|
|