This was a typo indeed. This is my code as of now:
<tr ng-repeat-start="item in items | orderByPriority">
<td class="span2"><img ng-src="{{item.fileSrc}}"
title="{{item.fileName}}" alt="{{item.fileName}}" width="50px"></td>
</tr>
<tr ng-repeat-end ng-show="editRow">
<td class="span2">
<div class="fileName">{{item.fileName}} <button
type="button" class="close" ng-click="item.name='';item.fileSrc=''"
ng-if="item.fileName">×</button></div>
<input type="file" upload-file
types={"img":["jpg","jpeg","bmp","png","gif"],"doc":["doc"],"appl":["pdf"]}
max-file-size="5">
</td>
</tr>
I believe that the dom element the ng-repeat-start directive is on _and_
the dom element ng-repeat-end is on share the same scope?
So if I set item.fileSrc=''" then I should be referencing the same item
object... But apparently that is not true because when I click the
button type="button" class="close"
I should see in firebug title="{{item.fileName}}" alt="{{item.fileName}}"
to evaluate to an empty string and nothing changes there as well...
Guess ng-repeat-start doesn't work as I hoped it would
On Monday, May 26, 2014 5:03:08 PM UTC+2, Eric Eslinger wrote:
>
> This might be a typo, but you're setting item.fileName on your ng-click,
> and item.fileSrc is the image source attribute.
>
> Also-also, item's not defined in that fragment you have up there. It's
> only meaningful inside the ng-repeat="item in items", outside of that I'm
> not sure what you'd be referencing.
>
> e
>
>
> On Mon, May 26, 2014 at 7:10 AM, Marc B <[email protected]<javascript:>
> > wrote:
>
>> Hello,
>>
>> I have a img with attr ng-source="item.fileSrc".=-, The img is displayed
>> because item.fileSrc contains image data. When I change the value of
>> item.fileSrc to '' in a ng-click handler, the img is still shown. I expect
>> it to disappear since the value for ng-source is "" after clicking the
>> button.
>>
>> This is my code:
>>
>> <tr ng-repeat-start="item in items | orderByPriority">
>> <td><img ng-src="{{item.fileSrc}}"></td>
>> </tr>
>> <tr ng-repeat-end>
>> <td>
>> <div><button type="button" class="close"
>> ng-click="item.fileName=''"> ×</button></div>
>> </td>
>> </tr>
>>
>> Image does not disappear, not even when adding $scope.$digest() in
>> ng-click or after updating the view by adding/removing text in a text input
>> field that is in the same $scope as the ng-repeat
>>
>> What amn I missing here?
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.