I am trying to improve performance on an angularJS app. my colleague told me that this....
<div ng-bind="getValue()"></div> //where this returns 'value'
Is less performant than this...
<div ng-bind="value"></div>
Is this true? If so why?
this only makes sense if it is one way binding. as it is a function and you don't need to watch/observe the changes might have some benefits but then there is a binding called one-way binding in ng. It would be wiser if you use it.
Edit: it is called one-time binding and only available AngularJS 1.3. But there is a good SO Question for it and alternative approach for 1.2, also have a very simple comparison .
getValue()is simplyreturn value;there'd be very little difference.