From 92dad578813cc0508402b5ded1feac1fd0eed3bb Mon Sep 17 00:00:00 2001 From: Ingo Date: Wed, 20 Nov 2024 20:29:08 -0500 Subject: [PATCH] fix: isStandalone defaults to true if angular >= 19 --- .../client/angular-beta/utils/PropertyExtractor.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.ts b/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.ts index dc12b820879..6bf66d2bcb7 100644 --- a/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.ts +++ b/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.ts @@ -11,6 +11,7 @@ import { Provider, ɵReflectionCapabilities as ReflectionCapabilities, importProvidersFrom, + VERSION, } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { @@ -176,15 +177,18 @@ export class PropertyExtractor implements NgModuleMetadata { const isDeclarable = isComponent || isDirective || isPipe; // Check if the hierarchically lowest Component or Directive decorator (the only relevant for importing dependencies) is standalone. - const isStandalone = !!( - (isComponent || isDirective) && + let isStandalone = (isComponent || isDirective) && [...decorators] .reverse() // reflectionCapabilities returns decorators in a hierarchically top-down order .find( (d) => this.isDecoratorInstanceOf(d, 'Component') || this.isDecoratorInstanceOf(d, 'Directive') - )?.standalone - ); + )?.standalone; + + //Starting in Angular 19 the default (in case it's undefined) value for standalone is true + if (isStandalone === undefined) { + isStandalone = !!(VERSION.major && Number(VERSION.major) >= 19); + } return { isDeclarable, isStandalone }; };