Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Angular Basics for Angular Hack Day 7 March 2020

Angular Basics for Angular Hack Day 7 March 2020

Angular Basics for Angular Hack Day 7 March 2020

- Building blocks
- Introduction to Observables

Aliaksei Kuncevič

March 07, 2020
Tweet

More Decks by Aliaksei Kuncevič

Other Decks in Education

Transcript

  1. kuncevic.dev @kuncevic CREATOR Aurelia vs React vs Vue vs Svelte

    vs Ember vs Elm vs Angular frontendwatch.com
  2. kuncevic.dev Components Communication 1. Parent to Child @Input() 2. Child

    to Parent @Output() 3. Custom Shared Service 4. State Management (ngxs, ngrx, akita, etc)
  3. kuncevic.dev Modules aka NgModules ✅ Helping to organize related things

    ✅ Combining logically related code usints (components, services, etc) together
  4. kuncevic.dev For Better Maintainability ✅ Create multiple modules (aka feature

    modules) ✅ Organize your modules ✅ Avoid having one big AppModule per app
  5. kuncevic.dev Rx extensions for Languages ✅ Java: RxJava ✅ JavaScript:

    RxJS ✅ C#: Rx.NET ✅ C#(Unity): UniRx ✅ Scala: RxScala ✅ Clojure: RxClojure ✅ C++: RxCpp ✅ Lua: RxLua ✅ Ruby: Rx.rb ✅ Python: RxPY ✅ Go: RxGo ✅ Groovy: RxGroovy ✅ JRuby: RxJRuby ✅ Kotlin: RxKotlin ✅ Swift: RxSwift ✅ PHP: RxPHP ✅ Elixir: reaxive ✅ Dart: RxDart
  6. kuncevic.dev Observer(s) vs Observable Observer is a behavioral design pattern.

    It specifies communication between objects: observable and observers
  7. kuncevic.dev Observer(s) vs Observable An observable is an object which

    notifies observers about the changes in its state
  8. kuncevic.dev Observable vs Promise Emits multiple values over period of

    time Emits only single value at a time Lazy (Cold). Observable is not called until we subscribe for it. Not Lazy (Hot).It is executed without calling then or catch Can be canceled by calling unsubscribe Not cancellable Supports operators like map, forEach, reduce, retry, retryWhen Operators are not available We can chain observables to handle complex logic on the streams We can use only then clause Predictable error handling Pushes errors down the chain
  9. kuncevic.dev Common RxJS operators Area Operators Creation from,fromEvent, of Combination

    combineLatest, concat, merge, zip, startWith , withLatestFrom, Filtering debounceTime, distinctUntilChanged, filter, take, takeUntil Transformation bufferTime, concatMap, map, mergeMap, scan, switchMap Utility tap Multicasting share