Your function and bool have the same name, $scope.openForm
You are overriding the function to false
on the close event (as well as true
on the open).
$scope.openForm = false; // <--- $scope.openForm is being set to a bool
$scope.openForm = function() { // <--- $scope.openForm is being set to a function
$scope.openForm = true; // <--- $scope.openForm is being set to a bool
console.log($scope.openForm);
}
$scope.closeForm = function() {
$scope.openForm = false; // <--- $scope.openForm is being set to a bool
console.log($scope.openForm);
}
Solution, use a different name for the bool
$scope.isFormOpen = false;
$scope.openForm = function() {
$scope.isFormOpen = true;
console.log($scope.isFormOpen);
}
$scope.closeForm = function() {
$scope.isFormOpen = false;
console.log($scope.isFormOpen);
}