Bird
0
0

Consider this Angular template:

medium📝 Predict Output Q5 of 15
Angular - Internationalization and Accessibility
Consider this Angular template:
<div [attr.aria-hidden]="isVisible ? 'false' : 'true'">Content</div>

If isVisible is false, what is the value of aria-hidden in the rendered HTML?
Aaria-hidden attribute is removed
Baria-hidden="false"
Caria-hidden="true"
Daria-hidden="undefined"
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the ternary expression in binding

    The expression sets aria-hidden to 'false' if isVisible is true, else 'true'.

  2. Step 2: Substitute isVisible = false

    When isVisible is false, the expression evaluates to 'true'.

  3. Final Answer:

    aria-hidden="true" -> Option C
  4. Quick Check:

    Conditional ARIA binding reflects correct string value [OK]
Quick Trick: Use ternary to toggle ARIA attribute string values [OK]
Common Mistakes:
  • Confusing boolean false with string 'false'
  • Expecting attribute removal on false
  • Mixing up true/false values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes