Bird
0
0

Which of the following commands correctly creates a service named auth using Angular CLI?

easy🧠 Conceptual Q2 of 15
Angular - Services and Dependency Injection
Which of the following commands correctly creates a service named auth using Angular CLI?
Ang new service auth
Bng create service auth
Cng add service auth
Dng generate service auth
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct CLI syntax for service creation

    The correct command to generate a service is ng generate service [name].
  2. Step 2: Identify the valid command among options

    Only ng generate service auth matches the correct syntax. Other commands are invalid or serve different purposes.
  3. Final Answer:

    ng generate service auth -> Option D
  4. Quick Check:

    Correct CLI syntax = ng generate service [name] [OK]
Quick Trick: Use 'ng generate service' to create services [OK]
Common Mistakes:
MISTAKES
  • Using 'ng create' instead of 'ng generate'
  • Confusing 'ng add' with service creation
  • Using 'ng new' which creates a new project

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes