0

I have two ng-repeat elements where I want to display data only when the text value of both the array element matches. I tried using ng-show but it doest not terminate the condition when the value matches.

<div ng-show="activity.id == actor"> found <span ng-repeat="text in activity.text"> \{{text}} </span> </div> 
2
  • what do you mean by when the text value of both the array element matches? do you wanted to compare each and every element of array? Commented Mar 24, 2016 at 11:24
  • let's take this example: I have ["One", "two", "three"] in actors aaray. In activities array I have ["two", ''nine","seven", "One"]. While iterating over first array I get "One" and if I find "One" then only it should print \\{text}} value. I hope it is clear to you now. @PankajParkar Commented Mar 24, 2016 at 11:28

1 Answer 1

1

try this

<div ng-if="activity.id === 'actor' && propertyFromSecond.ngrepeat ==='actor'"> 

Use ng-show if you need to hide or show information depending on situation Use ng-if if you sure you always want to render data that meets the condition. Elements inside of ng-if don't get into DOM if condition is not met.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.