I have a dropdown menu
that contains a list of image names. When an image is selected, it should be loaded and displayed using the ng-src directive
. Everything works perfectly fine when a name is chosen.
The issue arises when the dropdown menu
also includes an empty value
. If this empty option is selected, the ng-src
event attempts to load an image with no filename, resulting in a 404 error because the resource cannot be found by the server.
GET http://..../api/images/logo/ 404 (Not Found)
My question is: How can I prevent the loading event from triggering when the user selects the empty value?