Could you suggest how to make a picture appear in the row of the <td>Приз</td> table. If you simply insert a link to a picture, then it is displayed later on each line, and only 1-2-3 lines are required.

 var CupApp = angular.module('CupApp', []); CupApp.controller('CupCtrl', function($scope, $http) { $scope.cups = [{ "user": "Менеджер", "Total": 1715, "B_1011": 0, "B_1012": 0, "B_1013": 0, "B_1014": 0, "B_1015": 60, "B_1016": 0, "B_2021": 0, "B_2022": 60, "B_3031": 0, "B_3032": 0, "B_3033": 0, "B_3034": 0, "B_3035": 0, "B_3036": 0, "B_3039": 1595 }]; }); 
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script> <div ng-app="CupApp" ng-controller="CupCtrl"> <div id="container"> <div id="Html1"> <h2>Топ в компании</h2> <table class="table table-striped"> <tr> <th>Менеджер</th> <th>Балы</th> <th>Приз</th> </tr> <tr ng-repeat="cup in cups | orderBy: '-Total' "> <td ng-style="$index < 3 ? {'font-size' : '16pt'}: ''">{{ $index + 1}}</td> <td>{{cup.Total}}</td> <td>Приз</td> </tr> </table> </div> </div> </div> 

    1 answer 1

    I may be mistaken, but what prevents to create a variable for the prize in the same way as you did for points? And for good to make an array of objects of type

    var array = [{ Name:"Vasia", Role:"Manager",Prize:url}]

    and substitute it in repit as <img src={{array.Prize}}/> . And then, wherever you need, your prize will be null. (You can also put ng-show in img for the presence / absence of a prize)

    UPD

    There is a solution "vlob" - just add ng-if while $ index <3 display prizes.

    • If I do it as balls, then they will be substituted into each row in the table. And I need only the first 3 lines. The array itself comes to me in the json file, it is not yet possible to change it) - heymukki
    • Even if so, no one forbids you to change this array. You can simply use the json file as a data source, and inside the program turn it into a convenient form. But there is a solution "vlob" - just ng-if while index <3 display prizes - alexoander
    • Yes, through ng-if helped. Can I still ask you for help with json and angular? - heymukki
    • Write if I can help =) - alexoander
    • My page takes json data from the page that is uploaded to me on the network, it has authorization with login and password. I can’t get data from it, I can only take it from the json file in the site’s root folder - heymukki