I am trying to dynamically concatenate text on my AngularJS page. My goal is to display the ids of all users in the title. I declared a variable 't' using ng-init and tried to update the variable 't' in an ng-repeat loop to display it as my title (title = {{t}}). However, it's not updating as expected. Can someone suggest how to achieve this? I would like the output to look like:
<div title ="testID1ID2ID3">
<span>name1\ID1</span>
<span>name2\ID2</span>
<span>name3\ID3</span>
</div>
But currently, it is displaying:
<div title ="test">
<span>name1\ID1</span>
<span>name2\ID2</span>
<span>name3\ID3</span>
</div>
Template
<div ng-init= "t = 'test';" title="{{t}}>
<span ng-repeat = "(key,user) in users" t = "{{t + user.id}}">
{{user.name}} \ {{user.id}}
</span>
</div>