Bird
0
0

Which of the following is the correct way to set no style encapsulation in an Angular component?

easy📝 Syntax Q12 of 15
Angular - Components
Which of the following is the correct way to set no style encapsulation in an Angular component?
A@Component({ encapsulation: ViewEncapsulation.Emulated })
B@Component({ encapsulation: ViewEncapsulation.None })
C@Component({ encapsulation: ViewEncapsulation.Native })
D@Component({ encapsulation: ViewEncapsulation.ShadowDom })
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct encapsulation for no style isolation

    ViewEncapsulation.None disables style encapsulation, making styles global.
  2. Step 2: Check other options

    Emulated scopes styles, Native is deprecated, ShadowDom uses native Shadow DOM, so only None disables encapsulation.
  3. Final Answer:

    @Component({ encapsulation: ViewEncapsulation.None }) -> Option B
  4. Quick Check:

    No encapsulation = ViewEncapsulation.None [OK]
Quick Trick: None means no encapsulation, styles apply globally [OK]
Common Mistakes:
  • Using Emulated or ShadowDom instead of None
  • Confusing Native with None (Native is deprecated)
  • Missing the encapsulation property entirely

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes