When working in Angular, let's say I have the following functions:
$scope.getA= function(){
// do los stuff
return result;
};
$scope.getB= function(){
// do los stuff
return result;
};
$scope.getC= function(){
// do los stuff
return result;
};
//$scope.getD(), $scope.getE()...
I have some HTML elements with rendering logic dependent on complex conditions. Apart from readability, is there a difference in performance (render speed) between the two code snippets below? I noticed that the first one takes longer to display all elements compared to the second, but I am unsure if this observation holds true...
<div ng-if="getA()&&(getB()== "text"?getC():getD())||getE()">hello</div>
//more div tags like this...
and
$scope.show = function(){
var bar = getB()== "text"?getC():getD();
return getA()&&bar||getE();
}
//more functions like this...
<div ng-if="show()">hello</div>
//more div tags like this...