Angular modules Flashcards

1
Q

What is an Angular Module

A

Class with @NgModule decorator.
It
- Organizes the pieces of our application
- Arranges them into blocks
- Extend our application with capabilities from external libraries
- Provide a template resolution environment
- Arrange and re-export

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Ng module can be loaded in 2 ways?

A

Eagerly and Lazy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Every component, directive or pipe belong to

A

an angular module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Every application has

A

At least one angular module and at least one app component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Bootstrap Array

A

Defines the component that is the starting point of the application and the component that is loaded when app is started

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Bootstrap array must

A

bootstrap at least one component, the root app component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Bootstrap array should

A

only be used in the root app module, AppModule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Every component, directive and pipe we create is declared by the

A

Declarations array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Every component, directive and pipe we create must belong to

A

one and only one angular module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Declarations array only

A

declare component, directives and pipes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

All declared components, directives and pipes are private by default. They are only accessible to other components, directives and pipes declared in the

A

same module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The template resolution environment is provided by

A

its own module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Exports array allows us to

A

share components, directives and pipes with another modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

3rd party modules and system angular modules and our own modules can be

A

re-exported

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

If other components need to we can export with exports array

A

any component, directive or pipe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

We can export something without including it in the imports array

A

True. For example we can export the forms module without including it in the imports array

17
Q

Importing capabilities from other modules is happening by the imports array

A
18
Q

To use components, directives and pipe that one module is exporting to another module

A

add the module in the imports array

19
Q

We should import

A

only what this module needs

20
Q

Importing a module does not

A

provide access to its imported modules

21
Q

Imports are not

A

Inherited. That is why we sometimes need re-exporting.

22
Q

Register services provided by Angular or third-party modules

A

in the imports array. Normally we add a module that registers a service to the imports array of the app module.

This ensures that services are registered on time.

23
Q

The recommended way to register services is to

A

use the providedIn property of the @Injectable

24
Q

The browser module should only be imported

A

in the root application module

25
Q

The CommonModule exposes

A

*ngIf and *ngFor

26
Q

Routing in feature modules does not use .forRoot but uses

A

.forChild([]) instead

27
Q

The purpose of the shared module is to

A

organize commonly used pieces of our application

28
Q

In the imports array we add everything needed for the

A

templates associated with the components of the module.

29
Q

The main purpose of the app module is to

A

orchestrate the application as a whole

30
Q

Browser module is the module that each browser application

A

must add

31
Q

Declarations array declares

A

what belongs to this module

32
Q

Imports array imports modules

A

that this module needs

33
Q

Exports array exports

A

pieces (components, directives and pipes) to share

34
Q

Bootstrap array defines

A

what the index.html needs to start up the application