Angular Development Tutorials

This website is Brian Treese's Angular Development Blog. The site provides practical, hands-on tutorials and resources for developers who use the Angular framework. The tutorials cover modern Angular techniques including Signals, Components, Forms, Animations, CDK (Component Dev Kit), and Styling. Each tutorial includes code examples, video demonstrations, and step-by-step instructions to help you build Angular applications.

How to Build a Resizable Sidebar in Angular (Step-by-Step)

How to Build a Resizable Sidebar in Angular (Step-by-Step)

April 17, 2025

Resizable sidebars improve UX by letting users customize layouts, but implementing drag-to-resize functionality requires handling mouse events, calculating dimensions, and managing state. The Angular CDK Drag and Drop module simplifies this by providing built-in drag handling, boundary detection, and state management. This tutorial demonstrates how to build a resizable sidebar using only the Angular CDK, creating a professional drag-to-resize experience without external libraries.

How Angular Components Should Communicate in 2025

How Angular Components Should Communicate in 2025

April 10, 2025

Component communication in Angular has evolved from traditional inputs/outputs to modern two-way binding with model inputs, reducing boilerplate and simplifying parent-child data flow. This tutorial demonstrates three component communication patterns: one-way data flow with inputs/outputs, two-way binding with model inputs, and when to use each approach. You'll learn how to implement real-time communication between parent and child components using modern Angular patterns.

The Easiest Way to Add a Modal in Angular

The Easiest Way to Add a Modal in Angular

April 03, 2025

Building modals in Angular often requires third-party libraries or complex overlay code, but the Angular CDK Dialog provides a native, lightweight solution that handles positioning, focus management, and backdrop behavior automatically. This tutorial demonstrates how to create modals using the CDK Dialog service, open any component as a modal, customize styling, and add custom behavior without external dependencies. You'll learn the simplest way to add professional modals to your Angular applications.

Angular Directive Composition API: Enhance Components with Host Directives (v19+)

Angular Directive Composition API: Enhance Components with Host Directives (v19+)

March 27, 2025

Applying multiple directives to components creates verbose templates and makes it easy to forget required directives. Angular's Directive Composition API lets you embed directives directly into components, creating reusable component behaviors that can't be accidentally omitted. This tutorial demonstrates how to use host directives to add functionality like auto-focus, click-outside detection, and accessibility features directly into components, reducing template complexity and improving maintainability.

Angular Reactive Forms: Build Dynamic Checkbox Lists

Angular Reactive Forms: Build Dynamic Checkbox Lists

March 20, 2025

Dynamic checkbox lists are common in Angular forms, but building them with proper state management and "Select All" functionality requires understanding Reactive Forms patterns. This tutorial shows you how to generate checkbox controls dynamically from data, track selected values reactively, and implement a master "Select All" checkbox that toggles all items at once. You'll learn how to handle form state, validation, and user interactions efficiently.

Angular Page Titles: 3 Ways to Set Dynamic Titles

Angular Page Titles: 3 Ways to Set Dynamic Titles

March 13, 2025

Static page titles hurt SEO rankings, confuse users with multiple tabs open, and violate accessibility guidelines. Angular provides multiple ways to set dynamic page titles, from simple route-based titles to complex dynamic titles that change based on component data. This tutorial demonstrates three approaches: using the Title service in components, setting titles in route configuration, and handling dynamic titles with route resolvers. You'll learn how to ensure every page has a unique, descriptive title.

Angular Component Styling: Every Way to Add Styles (Complete Guide)

Angular Component Styling: Every Way to Add Styles (Complete Guide)

March 06, 2025

Angular offers multiple ways to add styles to components, each with different use cases and trade-offs. From inline styles in the decorator to external stylesheets, from programmatic styling with Renderer2 to CSS custom properties, choosing the right approach impacts maintainability and performance. This comprehensive guide walks through every styling method available in Angular, helping you make informed decisions for your components.

Angular Component Theming: CSS Custom Properties and :host-context

Angular Component Theming: CSS Custom Properties and :host-context

February 27, 2025

Component theming in Angular requires understanding how styles cascade and how to adapt components to different contexts. This tutorial demonstrates multiple theming strategies using CSS :host and :host-context selectors, along with CSS custom properties. You'll learn how to create flexible components that adapt their appearance based on where they're used, whether in a sidebar, main content area, or different color schemes. Each approach has trade-offs that we'll explore in detail.

Angular View vs Content: Understanding Signal Queries

Angular View vs Content: Understanding Signal Queries

February 20, 2025

The difference between "view" and "content" in Angular trips up many developers, leading to queries that don't work as expected. Understanding this distinction is crucial for working with signal queries like viewChild() and contentChild(). This tutorial explains the fundamental difference: "view" refers to a component's own template, while "content" refers to projected content from parent components. You'll learn when to use each query type and how to avoid common mistakes.

Untagged Template Literals... The Upgrade You Didn’t Know You Needed!

Untagged Template Literals... The Upgrade You Didn’t Know You Needed!

February 13, 2025

Dynamic class and style bindings in Angular templates often become complex, mixing string concatenation, ternary operators, and multiple bindings that are hard to read and maintain. Angular's template literal syntax provides a cleaner way to handle dynamic expressions, allowing you to use JavaScript template literals directly in templates for classes, styles, and complex interpolations. This tutorial demonstrates how to use template literals to simplify dynamic bindings and improve template readability.

Angular Content Projection: Complete Guide to ng-content and Slots

Angular Content Projection: Complete Guide to ng-content and Slots

February 06, 2025

Content projection is one of Angular's most powerful features for building flexible, reusable components. Instead of hardcoding content inside components, you can create "slots" where parent components inject their own content. This tutorial covers everything from basic single-slot projection to advanced multi-slot patterns and fallback content. You'll learn how to build components that adapt to different use cases without duplicating code.

Angular Component Selectors: Complete Guide to Element, Attribute, and Class Selectors

Angular Component Selectors: Complete Guide to Element, Attribute, and Class Selectors

January 30, 2025

Choosing the wrong component selector in Angular creates maintenance issues, breaks encapsulation, and limits component flexibility. Angular supports three selector types—element, attribute, and class—each with different use cases and trade-offs. This tutorial demonstrates all component selector options in Angular, helping you choose the right selector for your component based on reusability, styling needs, and integration requirements.

Angular ::ng-deep Alternatives Part 2: CSS Custom Properties and View Encapsulation

Angular ::ng-deep Alternatives Part 2: CSS Custom Properties and View Encapsulation

January 16, 2025

Replacing ::ng-deep requires understanding CSS Custom Properties, View Encapsulation modes, and component architecture patterns. This follow-up tutorial addresses common misconceptions about avoiding ::ng-deep and provides specific, production-ready examples using CSS Custom Properties and View Encapsulation settings. You'll learn why ::ng-deep is discouraged by the Angular team and practical alternatives that maintain component boundaries while allowing necessary style customization.

Angular SVG Components: Create Dynamic Interactive Graphics

Angular SVG Components: Create Dynamic Interactive Graphics

January 09, 2025

SVG components in Angular unlock powerful possibilities for data visualization and interactive graphics. Unlike static images, SVG components can respond to data changes, user interactions, and state updates in real time. This tutorial shows you how to transform basic lists into dynamic, interactive SVG charts using Angular's component system, signal-based reactivity, and template binding. You'll learn how to create scalable, data-driven visualizations that update automatically.

Angular Deferred Loading with Animations: Performance and UX (v19+)

Angular Deferred Loading with Animations: Performance and UX (v19+)

January 02, 2025

Loading content users never see wastes bandwidth and slows initial page loads, hurting performance metrics and user experience. Angular's deferred loading feature lets you load components only when they're needed, reducing initial bundle size and improving Core Web Vitals. This tutorial demonstrates how to combine deferred loading with animations, creating smooth transitions as components enter the viewport. Note: This uses Angular's deprecated animations module—modern alternatives are available.

Angular Form Validation: Complete Guide to Validators and Error Handling

Angular Form Validation: Complete Guide to Validators and Error Handling

December 27, 2024

Form validation is crucial for creating great user experiences in Angular applications. Without proper validation, users struggle with unclear errors, incomplete submissions, and frustrating experiences. This tutorial shows you how to implement comprehensive form validation using Angular Reactive Forms, including required fields, email validation, and real-time error messages. You'll learn how to display helpful feedback and prevent invalid submissions.

Angular ::ng-deep Alternatives: Modern Styling Approaches

Angular ::ng-deep Alternatives: Modern Styling Approaches

December 20, 2024

The deprecated ::ng-deep selector was Angular's way to break style encapsulation, but it causes maintenance issues, breaks encapsulation principles, and is no longer supported. Modern Angular provides better alternatives using CSS Custom Properties and View Encapsulation settings that maintain component boundaries while allowing necessary style overrides. This tutorial shows you how to replace ::ng-deep with maintainable, future-proof styling approaches that work with Angular's component architecture.

Angular Expand/Collapse Animation: Animate Height Changes (Deprecated Module)

Angular Expand/Collapse Animation: Animate Height Changes (Deprecated Module)

December 13, 2024

Expand and collapse animations make Angular UIs feel polished and professional. This tutorial demonstrates how to animate height changes using Angular's deprecated animations module. While this approach still works, modern Angular (v19+) offers better alternatives using CSS animations and DOM events. You'll learn the legacy approach here, but for new projects, consider using pure CSS transitions or Angular's new enter/leave animation API.

Angular Signals: set() vs update() - When to Use Each

Angular Signals: set() vs update() - When to Use Each

December 06, 2024

Choosing between set() and update() for writable signals in Angular seems trivial, but the wrong choice leads to verbose code, unnecessary complexity, or missed optimization opportunities. set() replaces the entire signal value, while update() transforms the current value using a callback function. This tutorial explains when each method is appropriate, demonstrates real-world examples, and shows how to write cleaner, more efficient signal update code.