diff --git a/README.md b/README.md index e2abfb4..27dbf6b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This goal of this project is to help you get better at Angular and NgRx by resol wrapFn pipe utilities pipe - +
RxJs diff --git a/apps/scroll-cd/README.md b/apps/scroll-cd/README.md index f5e5622..f5e089f 100644 --- a/apps/scroll-cd/README.md +++ b/apps/scroll-cd/README.md @@ -2,17 +2,21 @@ > Author: Thomas Laforge - - ### Information +This challenge will teach you how to avoid unnecessary change detection cycles. + +Zone.js will trigger a change detection cycle each time a scroll event is dispatched. However we only want to show or hide a button at a specific scroll position. Therefore, we only want to refresh our application once. + +> You can vizualise how many times CD is triggered by installing the [Angular chrome devTool](https://chrome.google.com/webstore/detail/angular-devtools/ienfalfjdbdpebioblfackkekamfmbnh) and starting a new recording on the profiler tab. + ### Statement -### Step 1 +Your goal for this challenge is to avoid all those unnecessary change detection cycle and trigger a CD only when needed. -### Step 2 +#### Constraint: -### Constraints: +You cannot opt-out of zone.js. If this code is part of a large project and you opt out of zone.js, you will break many things within your application. ### Submitting your work @@ -22,9 +26,9 @@ 4. **nx serve scroll-cd** 5. _...work on it_ 6. Commit your work -7. Submit a PR with a title beginning with **Answer:14** that I will review and other dev can review. +7. Submit a PR with a title beginning with **Answer:12** that I will review and other dev can review. -Mastering Change Detection cycle with a scroll example +Mastering Change Detection cycle with a scroll example - -
-
- -
-

- Hello there, - Welcome scroll-cd 👋 -

-
- - -
-
-

- - - - You're up and running -

- What's next? -
-
- - - -
-
- - - - - -
-

Next steps

-

Here are some things you can do with Nx:

-
- - - - - Add UI library - -
# Generate UI lib
-nx g @nrwl/angular:lib ui
-
-# Add a component
-nx g @nrwl/angular:component button --project ui
-
-
- - - - - View interactive project graph - -
nx graph
-
-
- - - - - Run affected commands - -
# see what's been affected by changes
-nx affected:graph
-
-# run tests for current changes
-nx affected:test
-
-# run e2e tests for current changes
-nx affected:e2e
-
-
- -

- Carefully crafted with - - - -

-
-
- `, - styles: [], - encapsulation: ViewEncapsulation.None, -}) -export class NxWelcomeComponent {}