<!-- template.html -->
<div ng-if="itemsExist(items)">
<!-- content -->
</div>
<!-- controller.js -->
function itemsExist(itemsList) {
return itemsList.length > 0;
}
vs
<!-- template.html -->
<div ng-if="$ctrt.hasItems()">
<!-- content -->
</div>
<!-- controller.js -->
$ctrt.hasItems = (itemsList) => {
return itemsList.length > 0;
};
Is it more effective to do the evaluation in JavaScript or directly in the HTML template?