Skip to content

Angular 02: components - #33

Merged
gpbsumido merged 5 commits into
ps/ng-01-structurefrom
ps/ng-02-components
Nov 21, 2026
Merged

gpbsumido merged 5 commits into
ps/ng-01-structurefrom
ps/ng-02-components

Conversation

@gpbsumido

@gpbsumido gpbsumido commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Second lesson in my Angular guide. It builds on the structure lesson, and its real change is the refactor every later lesson page depends on.

What shipped

Lesson 02: components (/thoughts/angular-02-components)

  • Covers the material at three levels (simple, intermediate, expert), then pitfalls and interview Q&A.
  • Topics: input(), output(), model(), content projection, lifecycle with DestroyRef, dynamic components, view encapsulation.
  • Live demo: a badge whose label and tone come in through inputs, whose count is two-way via [(count)], and whose dismiss button emits into an event log.

Lesson building blocks

  • New components: Lesson (layout), LessonDemo (demo frame), Callout (tip, pitfall, expert note), InterviewQuestions (native <details>).
  • Lesson 01 is rebuilt on them, which removes its inline copies of the same markup and styles.
  • Lesson uses ViewEncapsulation.None with .lesson-prefixed selectors, because emulated styles can't reach projected content.

Copy button on code samples. CodeBlock copies to the clipboard, announces "Copied" through a live region, and emits copied. A denied clipboard shows a visible failure message rather than doing nothing.

Version and changelog. 1.4.1, with a matching changelog entry.

Commits

  1. Add failing specs for lesson building blocks and lesson 02
  2. Extract lesson building blocks and a copy button for code samples
  3. Rebuild lesson 01 on the shared lesson blocks
  4. Write lesson 02 with a live input/output/model demo
  5. Bump to 1.4.1 with the lesson 02 changelog entry

Verification

  • ng test: 44 files, 326 tests, exit 0. Lint and both tsc --noEmit configs are clean.
  • The lesson 01 checker spec now queries .lesson-verdict[role="status"], because code blocks also have a status region.
  • Production build: no budget warnings, and /thoughts/angular-02-components is prerendered with the demo in the HTML.
  • Initial bundle went from 372.98 kB to 375.71 kB, which is @angular/core code for model()/output() hoisted into the shared chunk.

TO-DOs for this PR

  • Before/after screenshots of lesson 01 (restyled through the shared blocks) and lesson 02, light and dark. Chromium couldn't launch in the environment I built this in.

@gpbsumido
gpbsumido marked this pull request as ready for review November 21, 2026 14:47
@gpbsumido
gpbsumido added this pull request to stack #46 November 21, 2026 17:00
@gpbsumido
gpbsumido merged commit 530c68f into develop Nov 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant