Skip to content

Use top level imports to reference directives in standalone directives  #64448

@fireflysemantics

Description

@fireflysemantics

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

If I understand how signals are implemented correctly, the Angular compiler makes the signals work by compiling in the necessary scaffolding.

It would be nice to see the same feature / thinking applied to imports.

So instead of having to import in the component decorator like this:

@Component({
  // Import the `ProfilePhoto` component in
  // order to use it in this component's template.
  imports: [ProfilePhoto],
  /* ... */
})

The Angular compiler just reads the template or the class implementation of the component and scans for the imports being used and automatically scaffolds the code for the implementation.

Proposed solution

Use the compiler to "Understand" what imports are used in the implementation, so that the user can skip redeclaring imports within an @Directive ...

Alternatives considered

The way it's currently implemented ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecross-cutting: standaloneIssues related to the NgModule-less worldfeatureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions