I'm developing a controller in angular. For some reason there is an If statement that is giving me a issue, yes an if statement.
The code is the following:
$scope.new = function(logoFile) {
if($scope.comprobarCampoDesc() && $scope.comprobarCampoFecha() && $scope.comprobarCampoName() )
{
//program logic
}
Also there is the other pieces of code:
$scope.comprobarCampoName = function(e) {
//program logic
return bol;
};
$scope.comprobarCampoDesc = function(e) {
//program logic
return bol;
};
$scope.comprobarCampoFecha = function(e) {
//program logic
return bol;
};
Ok, For any reason that I'm not able to identify, the if statement only checks 2 of 3 methods, depending of the order. In this concrete case it is ignoring "$scope.comprobarCampoName" but if I change the order other method is witch doesn't work.
Thanks for the help. Greetings.
true?&&operator only evaluates the next operand(functionsin you case ) only if the operand before evaluates to true or equivalent.