As I start my journey into learning AngularJS, I am looking for some guidance from those who have experience with it. Although I am proficient in JavaScript/jQuery, I am finding it challenging to grasp the fundamentals of AngularJS at the moment.
My query involves a table that will be used to display "users" fetched through a GET request.
Each "user in users" will follow a schema resembling: {name:'', rating:4, reviews:10}
The "rating" field is an integer ranging from 1 to 5, where each number corresponds to a star (out of 5 possible stars). My goal is to create an IMG tag for each rating value that displays a single star.
This is a snippet of what I have:
<tbody>
<tr ng-repeat="user in users">
<td>{{user.name}}</td>
<td>
<img src="star.jpg" ng-repeat="n in [].constructor(user.rating) track by $index">
</td>
<td>{{user.reviews}}</td>
</tr>
</tbody>
I am struggling with setting up this loop correctly. The current implementation doesn't work as intended. My aim is to utilize {{user.rating}} to dictate the number of stars to display.
Your insights and assistance would be greatly appreciated.