Skip to content

Commit d81e78d

Browse files
committed
Add ngzone questions
1 parent dcf3be6 commit d81e78d

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

Diff for: README.md

+26-7
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@
247247
|239| [Can I share services using modules?](#can-i-share-services-using-modules)|
248248
|240| [How do you get current direction for locales??](#how-do-you-get-current-direction-for-locales)|
249249
|241| [What is ngcc?](#what-is-ngcc)|
250-
|242| [?](#)|
251-
|243| [?](#)|
252-
|244| [?](#)|
250+
|242| [What classes should not be added to declarations?](#what-classes-should-not-be-added-to-declarations)|
251+
|243| [Wat is ngzone?](#what-is-ngzone)|
252+
|244| [What is NoopZone?](#what-is-noopzone)|
253253
|245| [?](#)|
254254
|246| [?](#)|
255255
|247| [?](#)|
@@ -3549,16 +3549,35 @@
35493549
35503550
**[⬆ Back to Top](#table-of-contents)**
35513551
3552-
242. ### ?
3552+
242. ### What classes should not be added to declarations?
3553+
The below class types shouldn't be added to declarations
3554+
1. A class which is already declared in any another module.
3555+
2. Directives imported from another module.
3556+
3. Module classes.
3557+
4. Service classes.
3558+
5. Non-Angular classes and objects, such as strings, numbers, functions, entity models, configurations, business logic, and helper classes.
35533559
35543560
**[⬆ Back to Top](#table-of-contents)**
35553561
3556-
243. ### ?
3562+
243. ### What is NgZone?
35573563
35583564
**[⬆ Back to Top](#table-of-contents)**
35593565
3560-
244. ### ?
3561-
3566+
244. ### What is NoopZone?
3567+
Zone is loaded/required by default in Angular applications and it helps Angular to know when to trigger the change detection. This way, it make sures developers focus on application development rather core part of Angular. You can also use Angular without Zone but the change detection need to be implemented on your own and `noop zone` need to be configured in bootstrap process.
3568+
Let's follow the below two steps to remove zone.js,
3569+
1. Remove the zone.js import from polyfills.ts.
3570+
```js
3571+
/***************************************************************************************************
3572+
* Zone JS is required by default for Angular itself.
3573+
*/
3574+
// import 'zone.js/dist/zone'; // Included with Angular CLI.
3575+
```
3576+
2. Bootstrap Angular with noop zone in src/main.ts.
3577+
```js
3578+
platformBrowserDynamic().bootstrapModule(AppModule, {ngZone: 'noop'})
3579+
.catch(err => console.error(err));
3580+
```
35623581
**[⬆ Back to Top](#table-of-contents)**
35633582
35643583
245. ### ?

0 commit comments

Comments
 (0)