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

Angular DI Processor Pattern

Jecelyn Yeen
September 27, 2018

Angular DI Processor Pattern

Implement Processor Pattern with Angular Dependency Injection

Jecelyn Yeen

September 27, 2018
Tweet

More Decks by Jecelyn Yeen

Other Decks in Programming

Transcript

  1. @JecelynYeen From Kuala Lumpur, Malaysia • GDE - Web technologies,

    Angular • Software Architect @ Randstad Organizer:
  2. • Dependency Injection (DI) • DI in Angular • Processor

    Pattern • DI + Processor Pattern in Angular + +
  3. • UseClass • UseValue • UseFactory • UseExisting + https://offering.solutions/blog/articles/2018/08/17/using-useclass-usefactory-usevalue-

    useexisting-with-treeshakable-providers-in-angular/ https://blog.thoughtram.io/angular/2015/05/18/dependency-injection-in-angular-2.html
  4. - chart type - title / menu - processing logic

    - labels & tooltips Differences - they are all charts - same interface:- - processData() - name, title, etc Similar https://di-processor.firebaseapp.com
  5. what your chart library wants what you need to do

    • transform data (loop & group it by year month) • sort it • generate chart configuration
  6. Other useful scenario • Data table processors • Search processors

    https://stackoverflow.com/questions/48382323/angular-lookup-all- providers-implementing-a-specific-interface/ 48383858#comment83773434_48383858
  7. slides: https://speakerdeck.com/chybie/angular-di-processor-pattern demo: https://di-processor.firebaseapp.com code: https://github.com/chybie/di-processor code (inject by service):

    https://stackblitz.com/edit/ninja-weapon- processors?file=src%2Fapp%2Fninja%2Fninja.component.ts twitter: @JecelynYeen + +