Following snippet:
<h1>
{{pid.pname}}
<span style="font-size: 0.75em; text-shadow: none;">({{pid.pos}})</span>
<span style="font-size: 0.5em; text-shadow: none;"><a ng-href="#/team/{{pid.team | the_link}}/">{{pid.group}}</a></span>
</h1>
Filter the_link
defined like so...
myApp.filter('the_link', function() {
return function(longname) {
alert(longname);
var parts = longname.split(' ');
return parts[parts.length - 1].toLowerCase();
}
});
The alert()
call is fired several times on loading the page-- seemingly every time a {{...}}
is parsed (4 times in the snippet), and it's undefined except for the one time where the ngHref
is finally handled. Additionally, an $interpolate:interr
is fired three of the four times...
Why is this? I think I'm misunderstanding a lifecycle of some kind. Any clarity appreciated.