Bird
0
0

What will be the result of this import statement in an Angular component?

medium📝 Predict Output Q5 of 15
Angular - Standalone Components
What will be the result of this import statement in an Angular component?
import { Component, OnInit } from '@angular/core';
ANeither Component nor OnInit are imported
BOnly Component is imported; OnInit causes an error
CBoth Component and OnInit are available for use in the file
DOnInit is imported as default, Component is not
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the import syntax

    Both Component and OnInit are named exports imported using curly braces.
  2. Step 2: Confirm availability in the file

    Both will be available for use after this import statement.
  3. Final Answer:

    Both Component and OnInit are available for use in the file -> Option C
  4. Quick Check:

    Named imports bring all listed symbols [OK]
Quick Trick: Use curly braces to import multiple named exports [OK]
Common Mistakes:
  • Assuming only first symbol is imported
  • Confusing default and named imports

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes