0

Quite simply if I use:

{{item.areas[0]["post-codes"]}}

I can render out the required value.

If however I do:

<li ng-if="{{item.areas[0]["post-codes"]}} == yes">

Angular complains - what's the best approach for values like these?

1
  • what's the value of item.areas[0]["post-codes"] ? Commented Jun 24, 2015 at 15:42

1 Answer 1

2

Is the value actually yes? Is it a string, or is it the boolean value true?

  • You are also going to have a problem with your quotes there.
  • There should be no need for the curly braces inside the ng-if.
  • You should be using an identity operator (===)

Something like this:

<li ng-if="item.areas[0]['post-codes'] === 'yes'">
Sign up to request clarification or add additional context in comments.

1 Comment

it is a string so not a boolean, the above worked great - thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.