Skip to content

tranntn269/signals_present

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 

Repository files navigation

Talk Title: Signals- The Gems of May πŸ’Ž πŸ’Ž πŸ’Ž

Why choose this name although now is September? Because Signals is the new feature of Angular 16, which is released on May 2023.

Talk Description: ~ 15 mins

1. 5W1H in Signals.

πŸ‘‰ We will talk about: Why, What, How, Where, When.

  • Why do we need Signals?
  • What is a Signals?
  • How to create a Signals?
  • When to use Signals?
  • Where can we use signals?

2. Why not continue with zone.js?

πŸ‘‰ Mainly talk about signals and zone.js.

  • We will clarify the question: β€œWill Signals lead to zone.js being optional?”.
  • Drawbacks of zone.js: Angular depends on zone.js to trigger change detection. zoneJs will send a signal and notify Angular. As a result, Angular does not know where those events occur. Therefore, it need to run change detection from top to bottom in the component tree.

3. Are we going to have another change detection strategy?

πŸ‘‰ Talk about change detection.

  • Because Angular runs change detection from the top to bottom. That is the reason why we have OnPush.
  • But OnPush Strategy also has its own drawbacks, too.
    • As we’ve known, OnPush change detection provides the possibility to skip unnecessary checks for the component and all its children components.
    • But when we use detectChange() or markForCheck(), it breaks the rules.
      • detectChanges runs change detection immediately from the current component down through its children.
      • markForCheck marks current component and its parents up to the root as dirty for the next tick.
    • But it should be only components that read an updated signal that will have to be change-detected.
      • None of its parents and none of its children.
      • One and only one component that needs to display changed data
  • So, the question is: β€œAre we going to have another change detection strategy?”.
  • βœ”οΈ That’s a problem that Signals solves for us.

4. Manage RxJS traffic with Signals.

πŸ‘‰ Talk about signals and RxJS.

  • Problems: 2 subscribers to 1 Observable.
    • 🀧 Old solution: using shareReplay()
    • πŸ˜„ New solution: Signals
  • Reason: Maybe team does not adapt with RxJS, etc,...

5. Demo πŸ’» ~10 - 15mins

Other informations:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •