Ng-repeat onclick to show detail info in another div


#1

Hi everyone.

I have constructed an ion-list on the left side of my webpage. Some brief info are shown on the list.
What I am trying to do is to click on one of the items, then detail information will be shown on the right side. When I am not clicking on any item, the right side should be blank.

Moreover, can I add an image to each item on the ion-list depending on the info in the array? Say I have a field call “status” in the array, I would like to show image1 when the status is “A”, image2 when the status is “B”… how can I do so?

Anyone please provide me some hints or direction!
Thank you so much!!! Cheers!


#2

You can use ng-show or ng-hide to conditionally display/hide content.
If you want to show or hide something only once or a very few times then use ng-if

https://docs.angularjs.org/api/ng/directive/ngShow