Currently delving into the world of angularJS, I find myself perplexed by the scenario where multiple methods are triggered even though only one is explicitly called. The line in question looks like this:
<li ng-repeat="i in names" style="position: relative; top:{{mar(i)}}px; z-index:{{i}}; background-color: orange;" ng-click="clicker(i, $index)">{{i + " " + $index}}</li>
Essentially, I am faced with two "calls" within this line:
- The calculation for the top offset within the style attribute.
- The function that executes upon clicking the element using ng-click.
Upon clicking the element, both the mar(i) function and the ng-click function are triggered simultaneously.
My aim is to gain a clearer understanding of why this phenomenon occurs. For a hands-on experience, feel free to check out my plunk here.