Bird
0
0

You have this import in your Angular component:

hard📝 Application Q9 of 15
Angular - Standalone Components
You have this import in your Angular component:
import { Observable } from 'rxjs';
Later you want to import the map operator from RxJS. What is the correct way to import it directly?
Aimport map from 'rxjs';
Bimport { map } from 'rxjs/operators';
Cimport { map } from 'rxjs';
Dimport { map } from 'rxjs/operators/map';
Step-by-Step Solution
Solution:
  1. Step 1: Know RxJS import structure

    Operators like map are imported from 'rxjs/operators' as named exports.
  2. Step 2: Use correct named import syntax

    Use curly braces to import map: import { map } from 'rxjs/operators';
  3. Final Answer:

    import { map } from 'rxjs/operators'; -> Option B
  4. Quick Check:

    RxJS operators come from 'rxjs/operators' [OK]
Quick Trick: Import RxJS operators from 'rxjs/operators' with braces [OK]
Common Mistakes:
  • Importing operators directly from 'rxjs'
  • Using default import syntax for named exports

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes