When utilizing ng-repeat with dynamic ng-include that includes variables, the variables are not being properly recognized.
Take a look at this code snippet.
Here is the main HTML code:
<table style>
<tr>
<th>Student</th>
<th>Teacher</th>
</tr>
<tbody ng-repeat="val in data">
<tr>
<td>
<div ng-include src="'profile.html'" onLoad="profile=val.student"></div>
</td>
<td>
<div ng-include src="'profile.html'" onLoad="profile=val.teacher"></div>
</td>
</tr>
</tbody>
</table>
And here is the profile.html code:
<span>Id - {{profile.id}}</span>
<span>Name - {{profile.name}}</span>
Without using ng-include, everything works perfectly fine.
P.S. This is just a prototype of my desired functionality. I am specifically struggling with getting variables to work in dynamic ng-include within ng-repeat.
I have reviewed similar questions like these ones but haven't found any solutions:
1 2 3