Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module imports with standalone components (assuming ivy) #33507

Closed
amitport opened this issue Oct 31, 2019 · 12 comments
Closed

module imports with standalone components (assuming ivy) #33507

amitport opened this issue Oct 31, 2019 · 12 comments
Labels
area: core Issues related to the framework runtime core: directive matching core: NgModule feature: in backlog Feature request for which voting has completed and is now in the backlog feature Issue that requests a new feature
Milestone

Comments

@amitport
Copy link
Contributor

🚀 feature request

Relevant Package

Angular core

Description

I want to load simple components dynamically (not necessarily async),
in its template it may use simple things like ngFor and I want to avoid the complexity of an additional NgModules

Describe the solution you'd like

I want to be able to declare a component:

@Component({
  template: '<div *ngFor="let i of list">{{i}}</div>',
})
class MyDynamicComponent {}

and just load it in another module that already imports CommonModule:

<ng-container *ngComponentOutlet=MyDynamicComponent "></ng-container>

Describe alternatives you've considered

currently I need to define an ngModule just for the import:

@Component({
  template: '<div *ngFor="let i of list">{{i}}</div>',
})
class MyDynamicComponent {}

@NgModule({
  declarations: [
    MyDynamicComponent 
  ],
  imports: [
    CommonModule
  ],
})
export class UselessAngularModule { }

it would also be better if I could add the import on the component itself:

@Component({
  template: '<div *ngFor="let i of list">{{i}}</div>',
  imports: [CommonModule]
})
class MyDynamicComponent {}
@AndrewKushnir AndrewKushnir added the area: core Issues related to the framework runtime label Oct 31, 2019
@ngbot ngbot bot added this to the needsTriage milestone Oct 31, 2019
@AndrewKushnir AndrewKushnir added comp: ivy feature Issue that requests a new feature labels Oct 31, 2019
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Oct 31, 2019
@kara kara removed the comp: ivy label Nov 14, 2019
@amitport
Copy link
Contributor Author

Hi, it's been a while, is this being considered?

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Jun 4, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 4, 2021

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@amitport
Copy link
Contributor Author

amitport commented Jun 4, 2021

votes??

Two and an half years after a feature request is posted. A feature request that tries to resurface an issue with Angular that was posted as part of different bugs and features since day 1. ( This was not an issue with angular.js).

Unfortunately, or luckily, everyone who needed this feature probably already moved to react and others so I guess getting votes on this now is unlikely.

Your previous policy of just closing FR you didn't wish to do was better at least be direct about it and not wait for more than a couple of years to say that.

@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 26, 2021

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@angular-robot angular-robot bot added the feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors label Jun 26, 2021
@JoostK
Copy link
Member

JoostK commented Jul 15, 2021

Your previous policy of just closing FR you didn't wish to do was better at least be direct about it and not wait for more than a couple of years to say that.

Heya @amitport, sorry to hear you're upset about the recent introduction of voting (and having to wait 2.5 years without a reply, which is probably your larger complaint). The votes are just there to help measure interest in feature requests; requests will not be automatically closed or anything if there have been insufficient votes.

On the topic of this request, then. We're currently exploring what it would look like for components to be self-contained, in a project named "optional NgModules". The outcome of that project should be to allow what you're suggesting in this request.

@JoostK JoostK added feature: in backlog Feature request for which voting has completed and is now in the backlog and removed feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature: votes required Feature request which is currently still in the voting phase labels Jul 15, 2021
@JoostK JoostK added this to Inbox in Feature Requests via automation Jul 15, 2021
@JoostK JoostK moved this from Inbox to Proposed Projects in Feature Requests Jul 15, 2021
@JoostK
Copy link
Member

JoostK commented Jul 15, 2021

The description of #39695 also has a nice overview of the problem space, linking it here for visibility.

@npalladium
Copy link

@JoostK , is the source code of "optional NgModules" project mentioned above public? The closest I could find was this. Could you please link to it if possible? Thanks!

@JoostK
Copy link
Member

JoostK commented Oct 5, 2021

@JoostK , is the source code of "optional NgModules" project mentioned above public? The closest I could find was this. Could you please link to it if possible? Thanks!

Expect an RFC out for this project soon!

@npalladium
Copy link

Oh! That's great!

Thanks for the lightning fast response @JoostK!

@pkozlowski-opensource
Copy link
Member

For anyone tracking this issue - check our suggested solution described in the RFC: Standalone components, directives and pipes - making Angular's NgModules optional

@pkozlowski-opensource
Copy link
Member

We are implementing standalone components, directives and pipes!

Feature Requests automation moved this from Proposed Projects to Closed Apr 27, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime core: directive matching core: NgModule feature: in backlog Feature request for which voting has completed and is now in the backlog feature Issue that requests a new feature
Projects
No open projects
Development

No branches or pull requests

6 participants