Issue
Take a JSON that contains images and some other data along with it.
Solution
- Add a key to your JSON as "count": 0 and show that count on the image when clicked that image.
- declare a global variable named count:any = 0; and increase this count by 1 when clicked on the image and map this.count value to the object's key count
- Next create an array and push the same item to the array on click of the image who's count value we have just updated in step 2.
- Next when the image is de-selected, reset global count variable value and apply reset the count values of objects of JSON by iterating using a for loop.
please find the example here
Answered By - Anna
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.