I want to send the result of a function to a parent controller from a child.
Here is my file structure
-submission.controller.js
--calculate.controller.js
In calculate.controller.js i have a function that looks like:
function validForm() {
var checkForm = false;
if(files === true) {
checkForm = true;
}
return checkForm;
}
and i want to send the results of this function to the parent (submission.controller.js) and use it as an argument in a function.
showValidZip() {
if (validForm() === true) {
return false;
}
return true;
};
So far i've tried to use $emit and $on to send validForm from calculate to submission but havent had much luck in doing so.
for example:
$scope.$emit('validForm', function () {
var checkForm = false;
if(files === true) {
checkForm = true;
}
return checkForm;
});
and
$scope.showValidZip = function () {
if ($scope.$on('validForm') === true) {
return false;
}
return true;
};
but it's not really working as intended.