Skip to content

Commit c0b614c

Browse files
committed
Add module questions
1 parent 30058eb commit c0b614c

File tree

1 file changed

+186
-6
lines changed

1 file changed

+186
-6
lines changed

Diff for: README.md

+186-6
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,38 @@
225225
|217| [What is a routed entry component?](#what-is-a-routed-entry-component#)|
226226
|218| [Why is not necessary to use entryComponents array every time?](#why-is-not-necessary-to-use-entrycomponents-array-every-time)|
227227
|219| [Do I still need to use entryComponents array in Angular9?](do-i-still-need-to-use-entrycomponents-array-in-angular9#)|
228-
|220| [?](#)|
229-
|221| [?](#)|
230-
|222| [?](#)|
228+
|220| [Is it all components generated in production build?](#is-it-all-components-generated-in-production-build)|
229+
|221| [What is Angular compiler?](#what-is-angular-compiler)|
230+
|222| [What is the role of ngModule metadata in compilation process?](#what-is-the-role-of-ngmodule-metadata-in-compilation-process)|
231+
|223| [How does angular finds components, directives and pipes?](#how-does-angular-finds-components-directives-and-pipes)|
232+
|224| [Give few examples for NgModules?](#give-few-examples-for-ngmodules)|
233+
|225| [What are feature modules?](#what-are-feature-modules)|
234+
|226| [What are the imported modules in CLI generated feature modules?](#what-are-the-imported-modules-in-cli-generated-feature-modules)|
235+
|227| [What are the differences between ngmodule and javascript module?](#what-are-the-differences-between-ngmodule-and-javascript-module)|
236+
|228| [?](#)|
237+
|229| [?](#)|
238+
|230| [?](#)|
239+
|231| [?](#)|
240+
|232| [?](#)|
241+
|233| [?](#)|
242+
|234| [?](#)|
243+
|235| [?](#)|
244+
|236| [?](#)|
245+
|237| [?](#)|
246+
|238| [?](#)|
247+
|239| [?](#)|
248+
|240| [?](#)|
249+
|241| [?](#)|
250+
|242| [?](#)|
251+
|243| [?](#)|
252+
|244| [?](#)|
253+
|245| [?](#)|
254+
|246| [?](#)|
255+
|247| [?](#)|
256+
|248| [?](#)|
257+
|249| [?](#)|
258+
|250| [?](#)|
259+
|251| [?](#)|
231260

232261

233262
1. ### What is Angular Framework?
@@ -3268,14 +3297,165 @@
32683297
32693298
**[⬆ Back to Top](#table-of-contents)**
32703299
3271-
220. ### ?
3300+
220. ### Is it all components generated in production build?
3301+
No, only the entry components and template components appears in production builds. If a component isn't an entry component and isn't found in a template, the tree shaker will throw it away. Due to this reason, make sure to add only true entry components to reduce the bundle size.
32723302
32733303
**[⬆ Back to Top](#table-of-contents)**
32743304
3275-
221. ### ?
3305+
221. ### What is Angular compiler?
3306+
The Angular compiler is used to convert the application code into JavaScript code. It reads the template markup, combines it with the corresponding component class code, and emits component factories which creates JavaScript representation of the component along with elements of @Component metadata.
32763307
32773308
**[⬆ Back to Top](#table-of-contents)**
32783309
3279-
222. ### ?
3310+
222. ### What is the role of ngModule metadata in compilation process?
3311+
The `@NgModule` metadata is used to tell the Angular compiler what components to be compiled for this module and how to link this module with other modules.
3312+
3313+
**[⬆ Back to Top](#table-of-contents)**
3314+
3315+
223. ### How does angular finds components, directives and pipes?
3316+
The Angular compiler finds a component or directive in a template when it can match the selector of that component or directive in that template. Whereas it finds a pipe if the pipe's name appears within the pipe syntax of the template HTML.
3317+
3318+
**[⬆ Back to Top](#table-of-contents)**
3319+
3320+
224. ### Give few examples for NgModules?
3321+
The Angular core libraries and third-party libraries are available as NgModules.
3322+
1. Angular libraries such as FormsModule, HttpClientModule, and RouterModule are NgModules.
3323+
2. Many third-party libraries such as Material Design, Ionic, and AngularFire2 are NgModules.
3324+
3325+
**[⬆ Back to Top](#table-of-contents)**
3326+
3327+
225. ### What are feature modules?
3328+
Feature modules are NgModules, which are used for the purpose of organizing code. The feature module can be created with Angular CLI using the below command in the root directory,
3329+
```js
3330+
ng generate module MyCustomFeature //
3331+
```
3332+
Angular CLI creates a folder called `my-custom-feature` with a file inside called `my-custom-feature.module.ts` with the following contents
3333+
```js
3334+
import { NgModule } from '@angular/core';
3335+
import { CommonModule } from '@angular/common';
3336+
3337+
@NgModule({
3338+
imports: [
3339+
CommonModule
3340+
],
3341+
declarations: []
3342+
})
3343+
export class MyCustomFeature { }
3344+
```
3345+
**Note:** The "Module" suffix shouldn't present in the name because the CLI appends it.
3346+
**[⬆ Back to Top](#table-of-contents)**
3347+
3348+
226. ### What are the imported modules in CLI generated feature modules?
3349+
In the CLI generated feature module, there are two JavaScript import statements at the top of the file
3350+
1. NgModule: InOrder to use the `@NgModule` decorator
3351+
2. CommonModule: It provides many common directives such as `ngIf` and `ngFor`.
3352+
3353+
**[⬆ Back to Top](#table-of-contents)**
3354+
3355+
227. ### What are the differences between ngmodule and javascript module?
3356+
Below are the main differences between Angular NgModule and javascript module,
3357+
3358+
| NgModule | JavaScript module |
3359+
|---- | --------- |
3360+
| NgModule bounds declarable classes only | There is no restriction classes |
3361+
| List the module's classes in declarations array only | Can define all member classes in one giant file |
3362+
| It only export the declarable classes it owns or imports from other modules| It can export any classes |
3363+
| Extend the entire application with services by adding providers to provides array | Can't extend the application with services |
3364+
3365+
**[⬆ Back to Top](#table-of-contents)**
3366+
3367+
228. ### ?
3368+
3369+
**[⬆ Back to Top](#table-of-contents)**
3370+
3371+
229. ### ?
3372+
3373+
**[⬆ Back to Top](#table-of-contents)**
3374+
3375+
230. ### ?
3376+
3377+
**[⬆ Back to Top](#table-of-contents)**
3378+
3379+
231. ### ?
3380+
3381+
**[⬆ Back to Top](#table-of-contents)**
3382+
3383+
231. ### ?
3384+
3385+
**[⬆ Back to Top](#table-of-contents)**
3386+
3387+
232. ### ?
3388+
3389+
**[⬆ Back to Top](#table-of-contents)**
3390+
3391+
233. ### ?
3392+
3393+
**[⬆ Back to Top](#table-of-contents)**
3394+
3395+
234. ### ?
3396+
3397+
**[⬆ Back to Top](#table-of-contents)**
3398+
3399+
235. ### ?
3400+
3401+
**[⬆ Back to Top](#table-of-contents)**
3402+
3403+
236. ### ?
3404+
3405+
**[⬆ Back to Top](#table-of-contents)**
3406+
3407+
237. ### ?
3408+
3409+
**[⬆ Back to Top](#table-of-contents)**
3410+
3411+
238. ### ?
3412+
3413+
**[⬆ Back to Top](#table-of-contents)**
3414+
3415+
239. ### ?
3416+
3417+
**[⬆ Back to Top](#table-of-contents)**
3418+
3419+
240. ### ?
3420+
3421+
**[⬆ Back to Top](#table-of-contents)**
3422+
3423+
241. ### ?
3424+
3425+
**[⬆ Back to Top](#table-of-contents)**
3426+
3427+
242. ### ?
3428+
3429+
**[⬆ Back to Top](#table-of-contents)**
3430+
3431+
243. ### ?
3432+
3433+
**[⬆ Back to Top](#table-of-contents)**
3434+
3435+
244. ### ?
3436+
3437+
**[⬆ Back to Top](#table-of-contents)**
3438+
3439+
245. ### ?
3440+
3441+
**[⬆ Back to Top](#table-of-contents)**
3442+
3443+
246. ### ?
3444+
3445+
**[⬆ Back to Top](#table-of-contents)**
3446+
3447+
247. ### ?
3448+
3449+
**[⬆ Back to Top](#table-of-contents)**
3450+
3451+
248. ### ?
3452+
3453+
**[⬆ Back to Top](#table-of-contents)**
3454+
3455+
249. ### ?
3456+
3457+
**[⬆ Back to Top](#table-of-contents)**
3458+
3459+
250. ### ?
32803460
32813461
**[⬆ Back to Top](#table-of-contents)**

0 commit comments

Comments
 (0)