I wanted to replace anchor tag by img when user clicked on it. My Sample code is like
<div ng-repeat="postpart in currentPost.parts ">
<div ng-if = "postpart.type == 'MEDIA'">
<div ng-if = "!postpart.isclicked">
<img ng-src="{{imgurl}}" ng-click="iclicked(postpart)"/>
</div>
<div ng-if = "postpart.isclicked">
<a ng-href="{{postpart.description}}" ng-init="init()"></a>
</div>
</div>
</div>
iclicked function just make isclicked to true.
It worked perfectly for one part. But When there are 2 parts it is showing 2 images. When i click on first it replaces by one anchor element.
But in case of 2nd image click it replaces with 2 anchor tags.
How can i able to make it? is there any solution to replace image element by anchor in ng-repeat?
Aucun commentaire:
Enregistrer un commentaire