angular.module('app.controllers', []) .controller('surveyCtrl', ['$scope', '$stateParams', 'Survey', '$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, Survey, $ionicPopup) { $scope.data = { name: '', favorite_color: 'Porange', favorite_pizza: 'Pupperoni' } $scope.submitting = false; $scope.submit = function(){ $scope.submitting = true; Survey.add($scope.data).then(function(){ $scope.data = { name: '', favorite_color: 'Porange', favorite_pizza: 'Pupperoni' } $scope.submitting = false; $ionicPopup.alert({ title: 'Thank you!', template: 'Your response has been recorded.' }); }) } $scope.happy = function(){ var readyEvent = { "type": "ready", }; // The event bridge handles event represented as a string the best. So here we first create a Javascript object, then convert to stirng EventBridge.emitWebEvent(JSON.stringify(readyEvent)); // Send an event when user click on each of the gemstone buttons console.log(this.value + " button click"); var clickEvent = { "type": "click", "data": "Emerald"//this.value }; EventBridge.emitWebEvent(JSON.stringify(clickEvent)); $ionicPopup.alert({ title: 'Happy!', template: 'Your response has been recorded.' }); } }]) .controller('resultsCtrl', ['$scope', '$stateParams', // 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) { }]) .controller('searchCtrl', ['$scope', '$stateParams', // 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) { }])