Bird
0
0

Given this component code:

medium📝 component behavior Q4 of 15
Angular - Components
Given this component code:
@Component({selector: 'app-msg', template: '

{{message}}

'}) export class MsgComponent { message = 'Hello'; }

What will be rendered in the browser?
A<p>Hello</p>
B<p>{{message}}</p>
CError: message not defined
D<p></p>
Step-by-Step Solution
Solution:
  1. Step 1: Understand interpolation in template

    The {{message}} binds to the component's message property which is 'Hello'.
  2. Step 2: Determine rendered output

    The template renders the value 'Hello' inside <p> tags.
  3. Final Answer:

    <p>Hello</p> -> Option A
  4. Quick Check:

    Interpolation shows property value [OK]
Quick Trick: {{}} shows component property values in template [OK]
Common Mistakes:
  • Expecting raw {{message}} text
  • Assuming message is undefined
  • Thinking template renders empty paragraph

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes