I am trying to disable a button based on an angular object array being empty. My HTML below..
<ons-button ng-click="do stuff" ng-disabled="testFunc()">Add</ons-button>
This is inside an ng-app HTML and inside of a controller. My test function is below...
$scope.objs = [];
$scope.testFunc = function() {
if($scope.objs == null) {
return true;
}
else {
return false;
}
};
I have my function and the $scope.objs = [];
declared inside the controller, and the button is not being disabled. Am I doing something wrong?
EDIT: Appears the function is not even firing, will ng-disabled not fire once DOM is loaded. Also, could there be an issue with declaring the array and maybe it wasnt declared intime for the function to test it? Should I add an OR testing if its undefined
?