Build Your Own Library, Learn Advanced Angular Features
Would You Like to Build Your Own Open Source Library?
Probably all of us developers have thought at some point in time to build our own library and contribute to the overall open source community. The goal of this course is to give you all the tools necessary for you to be able to do your own open source Angular Library.
We will build a series of small open source libraries of progressively increasing difficulty, and we will learn a large number of Angular advanced features in a very fun and practical way.
What Is The Best Way To Learn Advanced Angular Features?
The best way to learn Angular and its most advanced features is to simply take and use it to build something very concrete, like for example an application or a library – and do it in a step-by-step way, as there is no replacement for that experience.
In order to understand a technology, we really need to build something non-trivial with it – blog posts and docs will only get us so far.
This is of course very time-consuming to do without any help because we will have to learn everything by ourselves along the way as we build something, gluing together an endless number of blog posts, documentation and Stackoverflow answers.
So because of this, in order to really dive deep into Angular we will be using it to build a series of small reusable libraries. The goal is to create a practice scenario, and learn the advanced features of Angular in their original use cases, where they make the most sense and so are easier to learn.
What Libraries Will We Build In This Course?
We will be building the following libraries, and learn how to publish them on NPM using the Angular Package Format: We will start by doing a Font Awesome customizable Input Box and learn the advantages of designing our components using content projection over a more input/output based design. At this stage we will also introduce the Angular Testing ecosystem.
Then we will progressively increase the difficulty of each library: we will build a dynamic tab container that allows to receive a template as a component input, effectively allowing to override parts of the component template while keeping a default look and feel for the component.
We will then build a reusable dynamic modal component with customizable content. This component have its contents configurable via either content projection or an input template, and will introduce the notion of Structural Directives.
We will also learn how directives and components of a given module can interact in a transparent way, independently of the place where they are used in the template, using a shared library service. We will then build a Input mask directive, where we will cover some advanced keyboard handling behavior.
At the end of the course, we are going to take all the components and directives that we built in previous sections, and we are going to build one larger example using them: A Payment Modal Widget!
We will then introduce the Angular Animations module, and use it to animate the modal widget, we will see how to define animations that can be reused across components.
What Will you Learn In this Course?
We will learn how to create an AOT compatible library in the Angular Package Format, how to define a library module, how to isolate the styles of a component but still make them customizable, how to design components and directives to make them easier to maintain – making them customizable while at the same time giving the components great default behavior.
We will cover all of the more advanced features of Angular, including Component API Design, Component Styling best practices, Templates and Template Outlets, ng-content, ng-container, style isolation and customization, AOT, global events, debugging with the CLI, @ViewChildren, @ContentChildren, Light DOM vs Shadow DOM, @HostBinding, @HostListener, dynamic components, directives, handling keyboard events, testing, animations and more (this is a non-extensive list).
But more than presenting the features in isolation, we will use them in real use cases which will make the features much easier to learn.
What Will You Be Able to do at the End Of This Course?
By the end of this course you will know many of the most advanced features of Angular, but most of all you will know when to use them and why. You will know how to build open source Angular libraries, and know how to make them available to the open source community on NPM.
With this advanced course, you will have a rock-solid foundation on Angular: you will very likely be able to tackle the more advanced Angular development tasks that you will come across in your day to day job or personal projects.
What you’ll learn
- Code in Github repository with downloadable ZIP files per section
- Learn the most advanced features of Angular
- learn how to how to build open source Angular libraries
- Component API Design
- Component Styling best practices
- Templates and Template Outlets, ng-content, ng-container, style isolation and customization
- AOT, global events, debugging with the CLI, @ViewChildren, @ContentChildren
- Light DOM vs Shadow DOM, @HostBinding, @HostListener, dynamic components
- Directives, handling keyboard events, testing, animations and more
Table of Contents
Course Overview and Development Environment Setup
1 Angular Advanced Course – Helicopter View
2 Recommended Software Versions
3 The Typescript Jumpstart Ebook
4 Installing Node, NPM, Git, IDE – An Alternative Webstorm Version
5 Installing The Lessons Code – Learn About Git Remote vs Local Branches
6 Installing Yarn and CLI, Setting Up a Development Server
Our First Angular Library – The Font Awesome And Material Design Input Boxes
7 How to Make The Most Of the Q&A Section
8 Demo of Our First Library – Font Awesome And Google Material Icons Input
9 Beginning The Implementation Of The Font Awesome Input Box
10 Angular Component Styling – Watch Style Isolation In Action
11 Learn An Angular CSS Extension Feature – The Host Pseudo Selector
12 Component Styling Best Practices – Ensure Solid Styles For Multiple Widget Sizes
13 Component API Design – Simpler and More Reusable Components With ng-content
14 Understanding ng-content and Style Isolation – Learn The Deep Style Modifier
15 ViewChild @ContentChild Configuration in Angular 8
16 The ContentChild Decorator, How Does It Work Component Design Best Practices
17 ContentChild, Directives and HostListener – Implementing the Input Focus Feature
18 Implementing The input Focus Functionality – The HostBinding Decorator
Styling Angular Components – Best Practices
19 Separating Structural Styles From Theme Styles – Making Components Themeable
20 How To Create An Alternative Component Theme And Ship It With The Library
21 Creating an Alternative Component Theme, See the CLI Sass Support In Action
22 Angular Style Isolation – Emulated View Encapsulation – Learn How It Works
23 Learn 2 More Alternative Ways of Handling CSS in Angular Applications
24 Setting Up A Library Module, Confirming AOT is Supported
25 Angular Component Testing Overview
26 The Angular CLI Testing Infrastructure – Running Our First Test
27 Adding Tests the Font Awesome Input – How to Test a Component
28 Angular Component Testing – Producing a More Readable Test Report
29 How To Debug Angular Tests
How to Publish An Angular Library
30 How To Publish A Library To a Private Enterprise NPM Repository
31 Material Design Input Box – Consolidation Exercise
32 Material Design Input Box – Consolidation Exercise Solution
33 Introduction To The Angular Library Quickstart Seed Repository
34 Learn The Main Benefits of Using The Angular Package Format
35 Review And Publication Of An Angular Library In the Angular Package Format
36 Final Library Publication Step – Test The Library With Different Consumers
Writing a Tab Container Component
37 Angular Library Demo – A Tab Container With Configurable Look And Feel
38 Switching To a New Branch – Reviewing the Tab Container Starting Point
39 Angular Component Styling – Commonly Needed Sass Features
40 Implementing The Tab Panel Component – Initial Version Up And Running
41 Using the Angular Template and Styling Features To Simplify Our HTML and CSS
42 Content Projection With @ContentChildren and The AfterContentInit Lifecycle Hook
43 The Tab Container Component – See The Initial Implementation Up And Running
44 Angular Advanced Features – ng-template , ng-container, ngTemplateOutlet
45 Learn Angular Template References And Input Template Partials
46 Testing The Tab Container Component
47 Angular Component Testing – How To Simulate User interaction
Modal Component and Structural Directives
48 Modal Component and Structural Directives – Section Introduction
49 How To Implement a Modal Component – Reviewing The HTML and CSS
50 Implementing a Modal Component – The First Version Up And Running
51 Configurable Angular Components – Content Projection and Input Templates
52 Structural Directives – How Do They Work Understanding Their Syntax
53 Step-By-Step Implementation of a Structural Directive – Learn ViewContainerRef
54 Running Into A Design Issue While Implementing The Modal Close Functionality
55 Implementing A General Communication Mechanism For Directive Interaction
56 Angular Global Keyboard Handling With EventManager
57 Learn Angular Multi-Slot Content Projection
58 Completing the Authentication Dialog – Learn How To Use ng-template Inputs
59 Preventing Memory Leaks
60 Implementing The Modal Tests, What’s Next
Advanced Keyboard Handling – The Input Mask Directive
61 The Input Mask Directive – Switching Branches
62 The Input Mask Directive That We Are About To Build
63 Input Mask Directive Skeleton – Learn ElementRef and Native Element Interaction
64 Implementing The Mask PlaceHolder Using The Reduce Functional Operator
65 HostListener Method Arguments – Blocking Default Keyboard Behavior
66 Overwritting the Current Cursor Position
67 Implementing The Input Mask Cursor Navigation Functionality
68 Digit Validation – Function Types and Polymorphic Programming Without Class
69 Digit Validation – Avoiding Writing Special Code For Null And Undefined
70 Input Mask – Implementing The Delete and Backspace Behavior
71 Finishing The Input Mask – The Select DOM Event and Enabling Text Copy
Final Example – Payment Widget Modal With Animations
72 All Together – Demo Of the Payment Widgets Modal
73 Angular Animations – Fade In and Fade Out Animations
74 Angular Animations – How To Define a Transition and an Animation Trigger
75 Angular Animation Parameters and Animation Lifecycle Hooks
Conclusions and Bonus Lesson
76 Bonus Lecture
77 Conclusions and Key Points