Ok fixed.
What happened was that in the line
<button type="button" class="close" ng-click="item.fileName=''">
the item.fileName='' ws set to an empty string, so everywhere the filename
was displayed, it was no more (e.g. img ng-src="{{item.fileSrc}}"
title="{{item.fileName}}" alt="{{item.fileName}}")
Only when I added item.fileSrc as in
<button type="button" class="close"
ng-click="item.fileName='';item.fileSrc=''">
the image was not removed. This is because when I have an img tag with only
a ng-src attribute, Angular automatically _adds_ a src attribute with the
same value as the ng-src attribute. This is visible in Firebug. So what
happens when I set the item.fileSrc attribute to ''? Nothing because there
is still a src attribute with the image file data. That data is apparently
hard-coded and thus not updated when the item.fileSrc value is set to ''.
The src attribute value invisibly takes over from the empty ng-src
attribute so the result is still an image.
Fix: don't use ng-src, just use a src attribute with a value set to
item.fileSrc so that when item.fileSrc is set to '', no image data is left
and no image is shown.
The only reason to use ng-src is the FOUC (Flash On Unknown Content) _or_
to be able to use expressions in the value of src attribute. Both don't
apply here
Marc
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.