Recall & Review
beginner
What does it mean to import dependencies directly in Angular?It means bringing in specific functions, classes, or modules from external libraries or Angular packages right where you need them in your code, so you can use them easily.
Click to reveal answer
beginner
How do you import a component from Angular's core package?You write: <code>import { Component } from '@angular/core';</code> This brings the Component decorator into your file.Click to reveal answer
beginner
Why is it better to import only what you need instead of the whole library?Importing only what you need keeps your app smaller and faster because it avoids loading extra code that you don't use.
Click to reveal answer
beginner
Show an example of importing a service directly in Angular.
Example: <code>import { HttpClient } from '@angular/common/http';</code> This lets you use HttpClient to make web requests.Click to reveal answer
beginner
What happens if you forget to import a dependency you use in your Angular file?Your code will give an error because Angular won't know what that function or class means without the import.Click to reveal answer
How do you import the RouterModule from Angular's router package?
✗ Incorrect
The correct syntax is
import { RouterModule } from '@angular/router'; which imports RouterModule from the router package.What is the benefit of importing dependencies directly in Angular?
✗ Incorrect
Importing only what you need keeps the app smaller and faster by avoiding extra unused code.
Which of these is a correct import statement in Angular?
✗ Incorrect
Correct syntax uses curly braces and the exact package name:
import { Injectable } from '@angular/core';What error might you see if you forget to import a dependency?
✗ Incorrect
If a dependency is missing, you often get a ReferenceError saying the item is not defined.
Where should you place import statements in an Angular file?
✗ Incorrect
Imports should be at the top of the file before any other code.
Explain how to import a dependency directly in Angular and why it is important.
Think about how you bring tools into your workspace only when you need them.
You got /4 concepts.
Describe what happens if you use a class or function in Angular without importing it first.
Imagine trying to use a tool you never took out of the toolbox.
You got /4 concepts.