Here's a strange behavior I want you to help me to examine: http://jsfiddle.net/m3Z8r/2/
I'm curious about why Angular calls symbolsLength()
function more times that I've expected:
- From the first time it was called twice (was expected to be called only once)
- When switching from
template1
totemplate2
it fires again (but there's no obvious need)
If you set initial templateName
to "template2"
, function symbolsLength()
will not be called, which is fine.
Please, can someone explain me what's going on here?
P.S. I understand that there's no need in symbolsLength()
function since we can just write {{ symbols.length }}
, but let's pretend that this function does something very important, for example, contacting service.