Angular ViewChild

Build the Perfect “Show More” Component in Angular

Build the Perfect “Show More” Component in Angular

July 24, 2025

Expandable content components are essential for long-form content, but implementing smooth height transitions requires handling dynamic content heights, coordinating CSS animations, and managing state. This tutorial demonstrates how to build a professional "show more" component in Angular with smooth height transitions, fade effects, and proper state management. You'll learn how to measure content height dynamically, create elegant expand/collapse animations, and handle edge cases like nested content and responsive layouts.

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.

Angular Signal Queries: Replace @ViewChild with viewChild() (v19+)

Angular Signal Queries: Replace @ViewChild with viewChild() (v19+)

November 08, 2024

Angular's @ViewChild and @ViewChildren decorators are being replaced by signal-based query functions that offer better type safety, automatic reactivity, and cleaner code. The new viewChild() and viewChildren() functions eliminate the need for lifecycle hooks, provide reactive updates, and integrate seamlessly with Angular's signal system. This tutorial walks through converting existing decorator-based queries to the modern signal query API, showing real-world examples and migration patterns.