From 420f7c4392a6d58ab579edb4c845139ad9a7eb10 Mon Sep 17 00:00:00 2001 From: Kam Date: Wed, 29 Jul 2026 11:32:28 +0300 Subject: [PATCH] docs: invoke signal inputs in adev examples and tutorials Several adev example and tutorial files read a signal input as a bare reference (this.foo) instead of invoking it (this.foo()). Because an InputSignal is a function object, the bare reference is always truthy and never yields the underlying value, so the surrounding guard or binding silently did the wrong thing: - animations open-close(.1/.3): the `!this.logging` guard in onAnimationEvent was always false, so the early return never fired. - form-validation forbidden-name.directive: the `this.forbiddenName` ternary condition was always truthy, so validation ran even when no forbidden name was configured. - first-app steps 12 and 14 housing-location: `housingLocation.photo` read `.photo` off the signal function (undefined), leaving the listing image src empty. Invoke the signals so the examples reflect correct signal-input usage. (cherry picked from commit 0d26130a4ce34daf9fb62bb19984f263492a219f) --- adev/src/content/examples/animations/src/app/open-close.1.ts | 2 +- adev/src/content/examples/animations/src/app/open-close.3.ts | 2 +- adev/src/content/examples/animations/src/app/open-close.ts | 2 +- .../form-validation/src/app/shared/forbidden-name.directive.ts | 2 +- .../steps/12-forms/src/app/housing-location/housing-location.ts | 2 +- .../14-http/src-final/app/housing-location/housing-location.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/adev/src/content/examples/animations/src/app/open-close.1.ts b/adev/src/content/examples/animations/src/app/open-close.1.ts index 32cad8301dd..d13a18e3412 100644 --- a/adev/src/content/examples/animations/src/app/open-close.1.ts +++ b/adev/src/content/examples/animations/src/app/open-close.1.ts @@ -57,7 +57,7 @@ export class OpenCloseKeyframeComponent { logging = input(false); onAnimationEvent(event: AnimationEvent) { - if (!this.logging) { + if (!this.logging()) { return; } } diff --git a/adev/src/content/examples/animations/src/app/open-close.3.ts b/adev/src/content/examples/animations/src/app/open-close.3.ts index c05c20f2b5f..f1554bf949a 100755 --- a/adev/src/content/examples/animations/src/app/open-close.3.ts +++ b/adev/src/content/examples/animations/src/app/open-close.3.ts @@ -33,7 +33,7 @@ export class OpenCloseBooleanComponent { logging = input(false); onAnimationEvent(event: AnimationEvent) { - if (!this.logging) { + if (!this.logging()) { return; } } diff --git a/adev/src/content/examples/animations/src/app/open-close.ts b/adev/src/content/examples/animations/src/app/open-close.ts index 886b8f17382..80c475be479 100755 --- a/adev/src/content/examples/animations/src/app/open-close.ts +++ b/adev/src/content/examples/animations/src/app/open-close.ts @@ -70,7 +70,7 @@ export class OpenClose { // #docregion events1, events onAnimationEvent(event: AnimationEvent) { // #enddocregion events1, events - if (!this.logging) { + if (!this.logging()) { return; } // #docregion events diff --git a/adev/src/content/examples/form-validation/src/app/shared/forbidden-name.directive.ts b/adev/src/content/examples/form-validation/src/app/shared/forbidden-name.directive.ts index 23083132fe0..de44d1b85f1 100644 --- a/adev/src/content/examples/form-validation/src/app/shared/forbidden-name.directive.ts +++ b/adev/src/content/examples/form-validation/src/app/shared/forbidden-name.directive.ts @@ -34,7 +34,7 @@ export class ForbiddenValidatorDirective implements Validator { readonly forbiddenName = input('', {alias: 'appForbiddenName'}); validate(control: AbstractControl): ValidationErrors | null { - return this.forbiddenName + return this.forbiddenName() ? forbiddenNameValidator(new RegExp(this.forbiddenName(), 'i'))(control) : null; } diff --git a/adev/src/content/tutorials/first-app/steps/12-forms/src/app/housing-location/housing-location.ts b/adev/src/content/tutorials/first-app/steps/12-forms/src/app/housing-location/housing-location.ts index 09605664854..21bb0dc6532 100644 --- a/adev/src/content/tutorials/first-app/steps/12-forms/src/app/housing-location/housing-location.ts +++ b/adev/src/content/tutorials/first-app/steps/12-forms/src/app/housing-location/housing-location.ts @@ -9,7 +9,7 @@ import {RouterLink} from '@angular/router';
Exterior photo of {{ housingLocation().name }} diff --git a/adev/src/content/tutorials/first-app/steps/14-http/src-final/app/housing-location/housing-location.ts b/adev/src/content/tutorials/first-app/steps/14-http/src-final/app/housing-location/housing-location.ts index 09605664854..21bb0dc6532 100644 --- a/adev/src/content/tutorials/first-app/steps/14-http/src-final/app/housing-location/housing-location.ts +++ b/adev/src/content/tutorials/first-app/steps/14-http/src-final/app/housing-location/housing-location.ts @@ -9,7 +9,7 @@ import {RouterLink} from '@angular/router';
Exterior photo of {{ housingLocation().name }}