diff --git a/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.test.ts b/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.test.ts index 45d2fb73e62f..c5be68cc1a34 100644 --- a/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.test.ts +++ b/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.test.ts @@ -18,6 +18,7 @@ const TestComponent1 = Component({})(class {}); const TestComponent2 = Component({})(class {}); const StandaloneTestComponent = Component({ standalone: true })(class {}); const TestDirective = Directive({})(class {}); +const StandaloneTestDirective = Directive({ standalone: true })(class {}); const TestModuleWithDeclarations = NgModule({ declarations: [TestComponent1] })(class {}); const TestModuleWithImportsAndProviders = NgModule({ imports: [TestModuleWithDeclarations], @@ -117,6 +118,19 @@ describe('PropertyExtractor', () => { TestModuleWithImportsAndProviders, StandaloneTestComponent, ]); + + it('should return standalone directives', () => { + const imports = extractImports( + { + imports: [TestModuleWithImportsAndProviders], + }, + StandaloneTestDirective + ); + expect(imports).toEqual([ + CommonModule, + TestModuleWithImportsAndProviders, + StandaloneTestDirective, + ]); }); }); 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 d8664259e158..e6db7384488f 100644 --- a/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.ts +++ b/code/frameworks/angular/src/client/angular-beta/utils/PropertyExtractor.ts @@ -173,7 +173,7 @@ export class PropertyExtractor implements NgModuleMetadata { const isPipe = decorators.some((d) => this.isDecoratorInstanceOf(d, 'Pipe')); const isDeclarable = isComponent || isDirective || isPipe; - const isStandalone = isComponent && decorators.some((d) => d.standalone); + const isStandalone = (isComponent || isDirective) && decorators.some((d) => d.standalone); return { isDeclarable, isStandalone }; };