Skip to content

Commit 30058eb

Browse files
committed
Add entryComponents questions
1 parent 68f8ee8 commit 30058eb

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

Diff for: README.md

+22-8
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@
221221
|213| [What is an entry component?](#what-is-an-entry-component)|
222222
|214| [What is a bootstrapped component?](#what-is-a-bootstrapped-component)|
223223
|215| [How do you manually bootstrap an application?](#how-do-you-manually-bootstrap-an-application)|
224-
|216| [?](#)|
225-
|217| [?](#)|
226-
|218| [?](#)|
227-
|219| [?](#)|
224+
|216| [Is it necessary for bootstrapped component to be entry component?](#is-it-necessary-for-bootstrapped-component-to-be-entry-component)|
225+
|217| [What is a routed entry component?](#what-is-a-routed-entry-component#)|
226+
|218| [Why is not necessary to use entryComponents array every time?](#why-is-not-necessary-to-use-entrycomponents-array-every-time)|
227+
|219| [Do I still need to use entryComponents array in Angular9?](do-i-still-need-to-use-entrycomponents-array-in-angular9#)|
228228
|220| [?](#)|
229229
|221| [?](#)|
230230
|222| [?](#)|
@@ -3238,19 +3238,33 @@
32383238
32393239
**[⬆ Back to Top](#table-of-contents)**
32403240
3241-
216. ### ?
3241+
216. ### Is it necessary for bootstrapped component to be entry component?
3242+
Yes, the bootstrapped component needs to be an entry component. This is because the bootstrapping process is an imperative process.
32423243
32433244
**[⬆ Back to Top](#table-of-contents)**
32443245
3245-
217. ### ?
3246+
217. ### What is a routed entry component?
3247+
The components referenced in router configuration are called as routed entry components. This routed entry component defined in a route definition as below,
3248+
```js
3249+
const routes: Routes = [
3250+
{
3251+
path: '',
3252+
component: TodoListComponent // router entry component
3253+
}
3254+
];
3255+
```
3256+
Since router definition requires you to add the component in two places (router and entryComponents), these components are always entry components.
3257+
**Note:** The compilers are smart enough to recognize a router definition and automatically add the router component into `entryComponents`.
32463258
32473259
**[⬆ Back to Top](#table-of-contents)**
32483260
3249-
218. ### ?
3261+
218. ### Why is not necessary to use entryComponents array every time?
3262+
Most of the time, you don't need to explicity to set entry components in entryComponents array of ngModule decorator. Because angular adds components from both @NgModule.bootstrap and route definitions to entry components automatically.
32503263
32513264
**[⬆ Back to Top](#table-of-contents)**
32523265
3253-
219. ### ?
3266+
219. ### Do I still need to use entryComponents array in Angular9?
3267+
No. In previous angular releases, the entryComponents array of ngModule decorator is used to tell the compiler which components would be created and inserted dynamically in the view. In Angular9, this is not required anymore with Ivy.
32543268
32553269
**[⬆ Back to Top](#table-of-contents)**
32563270

0 commit comments

Comments
 (0)