Understanding Angular Injection Context and Signal equality functionsDependency Injection (DI) is a pivotal design pattern that empowers developers to decouple their code, facilitating easier reuse of classes and services. In the context of Angular, DI plays a crucial role in supplying dependencies to components, dire...Aug 28, 2024 · 2 min readnhannguyen.hashnode.dev
Create Angular Components Dynamically at runtimeDynamically create and destroy components We need two things. Some components. Some certain ViewContainer will be used to create this component. The first part is just a class constructor of the component we want to create. The ViewComtainer is m...Aug 23, 2024 · 2 min readnhannguyen.hashnode.dev
Angular Cross Chat Tab with the BroadcastChannel APIIntroducing the BroadcastChannel API The BroadcastChannel API allows communication of different browsing contexts (windows, tabs, iframes). It’s explicitly designed to broadcast messages to other windows/tabs of the same origin. The BroadcastChannel ...Aug 21, 2024 · 2 min readnhannguyen.hashnode.dev
JavaScript Design Patterns - Behavioral - TemplateThe template pattern allows defining the skeleton of an algorithm in the superclass but lets subclasses override specific algorithm steps without changing its structure. In this example, We are creating a simple template method to calculate taxes and...Aug 20, 2024 · 1 min readnhannguyen.hashnode.dev
JavaScript Design Patterns — Behavioral — StrategyThe strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. In this example, We have a set of discounts that can be applied to a shopping cart. We can pass the function that we will apply to the constru...Aug 16, 2024 · 1 min readnhannguyen.hashnode.dev