angular
.module('myApp')
.controller('MessageController', MessageController);
MessageController.$inject = ['$scope', '$stateParams', '$uibModalInstance', 'MessageTemplate', 'JhiLanguageService'];
onFormatChange.$inject = ['$resource', '$http', 'ServerURL']; // should it be vm.onFormatChange.$inject instead?
function MessageController ($scope, $stateParams, $uibModalInstance, MessageTemplate, JhiLanguageService) {
var vm = this;
vm.isSaving = false;
vm.text = 'Activated'; // this is the only variable
// im trying to send to Java
function onSaveSuccess (result) {
// a console.log
}
function onSaveError (error) {
// a console.log
}
// this function gets called from the HTML via ng-change
vm.onFormatChange = function () {
vm.text = vm.status ? 'Deactivated' : 'Activated';
// Sending vm.text (as "format") to the server
format: vm.text // should it be format = vm.text?
}. {withCredentials: true,
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Access-Control-Allow-Origin': true,
'X-Requested-With': 'XMLHttpRequest'
}
}).then(onSaveSuccess, onSaveError);
}
}