NNNhan Nguyeninnhannguyen.hashnode.dev·Aug 28, 2024 · 2 min readUnderstanding 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...00
NNNhan Nguyeninnhannguyen.hashnode.dev·Aug 23, 2024 · 2 min readCreate 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...00
NNNhan Nguyeninnhannguyen.hashnode.dev·Aug 21, 2024 · 2 min readAngular 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 ...00
NNNhan Nguyeninnhannguyen.hashnode.dev·Aug 20, 2024 · 1 min readJavaScript 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...00
NNNhan Nguyeninnhannguyen.hashnode.dev·Aug 16, 2024 · 1 min readJavaScript 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...00