You are returning true/false to the promise method, thats never gonna work. You should check into promises ( $q, available in angular) and resolve/reject after the check. But im not quite sure wether that would work in the ng-if construction.
Buttt, if i read your code correctly, there’s a possibility the image doesn’t exist? When you do it this way, you’ll have the user download a lot files…
you cannot run a $http webservice in ng-if.
because ng-if execute the function in loop so fast without waiting for the$http response and that what cause the errors.
I think the solution would be to call the webService just once in ng-init, store the respond value in a document related variable (the current item of filtered) , and then check this variable in ng-if.