Link to home
Start Free TrialLog in
Avatar of ank5
ank5Flag for India

asked on

Passing values between two HTML elements in angular [Ionic]

I am using ionic slide box, where I iterate over number of images and show them in the slide box

<ion-slide-box>
<!-- Iterate n number of times, where n is the number of images -->
  <ion-slide ng-repeat="n in [].constructor(imageCount) track by $index">
    <img ng-src="MyImage-{{$index + 1}}.png" width="100%" height="auto" > 
  </ion-slide>
</ion-slide-box>

Open in new window

Each image is identified by a counter at the end. So, if there are 5 images then this code iterates 5 times and loads images called 'MyImage_1', 'MyImage_2' etc, and shows them in the slide box.

Just below the slidebox, I am showing an edit button. When user clicks on the button, then image that is loaded in the slidebox is opened is another page for editing.

 
<div style=" padding-bottom: 10px;">
         <a class="button button-dark icon ion-edit" ui-sref="editImage({name:'MyImage_$index'})"></a>
 </div>

Open in new window

The challenge is that how to find which image is opened in the slidebox. $index has this information but it is available only inside slidebox and not to a div outside of the slidebox.

How can I tell the anchor tag which index user is in when he clicks on the edit link.
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Does the active image not have a class to identify it is the active image
Avatar of ank5

ASKER

Can you please elaborate what you mean by class?

It's just the below code that allows users to slide

<ion-slide-box>
<!-- Iterate n number of times, where n is the number of images -->
  <ion-slide ng-repeat="n in [].constructor(imageCount) track by $index">
    <img ng-src="MyImage-{{$index + 1}}.png" width="100%" height="auto" > 
  </ion-slide>
</ion-slide-box>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial