Just wondering if there is a recommended solution for the following scenario.
I have a complex expression in my markup to show some error message, e.g.
ng-show="currentSection == 'pickup-from' && carHireEnquiryForm.pickUpLocation.$dirty && carHireEnquiryForm.pickUpLocation.$invalid && carHireEnquiryForm.pickUpLocation.$error.isLocation"
This can make the markup messy and hard to unit test, so to get around this I created a function for this, e.g.
ng-show="isShowError()"
Now the isShowError can easily be tested. Problem now is that the isShowError is invoked on every digest even if the element is not visible. This for me is even worst as performance it very important.
Is there a better way to achieve this? Is expressions the recommend way to do this? What if the expression had to include 20 statements? I am keen to reduce the amount of business logic in my markup as well.
Thanks in advance