如何根据在angularjs中使用if条件的值加载图像

how to load images according to the value coming using if condition in anguilarjs

我正在尝试根据值显示占用和空闲图像。如果值大于 3.50,则应显示图像 1 如果其等于或小于 3.50,则显示图像 2。 我试过这段代码,但我无法找到我在哪里做错了。我没有得到任何图像。

代码

 <td><img ng-if ng-src="{{getSlotImage(parkingslot1)}}" /></td>
    <script>
            var app = angular.module('myApp', []);
            app.controller('myCtrl', function ($scope, $http) {
                $http.get('https://example.com', {
                    headers: { 'Authorization': 'Basic 23456==' }
                })
                   .then(function (response) {
                       $scope.names = response.data;
                       $scope.decodedFrame = atob($scope.names.dataFrame);
                       $scope.decodedFrameNew = $scope.decodedFrame.substring(4);
                       $scope.distanceinFeet = 835 * 0.95;
                       $scope.Value = $scope.distanceinFeet / 148;
                       $scope.parkingslot1 = $scope.Value.toFixed(2);
                       $scope.names.timestamp = new Date($scope.names.timestamp).toLocaleString(); // Parse the date to a localized string
                   });

                $scope.getSlotImage = function (slot) {
                                       var imageUrl = slot > 3.5 ? 'http://icons.iconarchive.com/icons/custom-icon-design/flatastic-9/256/Accept-icon.png' :
                            'https://cdn3.iconfinder.com/data/icons/musthave/256/Cancel.png';


                    return imageUrl;


                }
                });


        </script>

删除标签中的 ng-if 属性