- Notifications
You must be signed in to change notification settings - Fork27k
[Complete] RFC: Standalone components, directives and pipes - making Angular's NgModules optional#43784
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Author: Pawel Kozlowski The goal of this RFC is to validate the design with the community, solicit feedback on open questions, and enable experimentation via a non-production-ready prototype included in this proposal. Motivation
More importantly,
Given this central role of Dynamic component creation exampleThe following example, which dynamically renders a component, contains a subtle, yet critical, problem and is not guaranteed to work at runtime as a result!: import{Component,ViewContainerRef}from'@angular/core';import{UserViewComponent}from'./business-logic';@Component({...})classDynamicUserView{constructor(privateviewContainerRef:ViewContainerRef){}renderUserView():void{this.viewContainerRef.createComponent(UserViewComponent);}} Suppose @Component({...})exportclassUserViewComponent{constructor(readonlyservice:UserViewService){}}@NgModule({declarations:[UserViewComponent],imports:[/* dependencies here */],providers:[{provide:UserViewService,useClass:BackendUserViewService}],})exportclassUserViewModule{}
Attempting to instantiate Some components do not have such dependencies — they don’t rely on configuration provided in their Components need NgModulesThis may seem like an implementation detail of specific components, but in fact it illustrates a fundamental property of the framework: Angular is one of the only web frameworks where components are not the “units of reuse”. Having Angular conceptually centered around
Main benefits of this proposalMove Angular in a direction where components, directives, and pipes play a more central role, are self-contained and can be safely imported / used directly.
The mental model shift is the main motivation of this proposal, but there are additional benefits of the reduced conceptual surface (fewer things to learn) and API surface (less code to write). All these benefits combined should make Angular:
Goals and non-goalsGoals
Non-GoalsThis proposal is not trying to remove the concept of a At the same time we believe that it paves the path towards greatly reducing the role of ProposalCurrent stateIn Angular today, developers use Depending on things indirectly via an imported
Collaborating directives exampleWhen the <inputtype="text"[(ngModel)]="twoWayBoundExpr"> it also expects the collaborating The Both the Most Forms users are entirely unaware of this mechanism. Generally speaking components, directives or pipes declared in a Standalone components, directives, and pipesA standalone directive, component, or pipe is not declared in any existing
The ℹ️ Adding the Simple exampleLet's examine a simple example: import{Component}from'@angular/core';@Component({standalone:true,template:`I'm a standalone component!`})exportclassHelloStandaloneComponent{} In
Dependencies exampleSince a standalone component has no association with an import{Component}from'@angular/core';import{FooComponent,BarDirective,BazPipe}from'./template-deps';@Component({standalone:true,imports:[FooComponent,BarDirective,BazPipe],template:` <foo-cmp></foo-cmp> <div bar>{{expr | baz}}</div> `})exportclassExampleStandaloneComponent{} Interop with |
BetaWas this translation helpful?Give feedback.
All reactions
👍 321👎 5😄 29🎉 93❤️ 145🚀 100👀 43
Replies: 70 comments 146 replies
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thanks for the detailed explanation and examples. Looks good to me Update (12/06/2021): Okay, after reading through comments, RFC (again), and based on my experience from other frameworks. Here are my thoughts
|
BetaWas this translation helpful?Give feedback.
All reactions
👍 11😄 1
-
This proposal looks like a great way to remove a lot of boilerplate ngModule code. How would lazy loading / bundling work if everything was heirachially declared through component imports? Would the compiler/optimiser make good choices? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yeah, I have a similar question. I remember about 2.5 years ago at Google I/O 19 (video), an example was demonstrated with pre-rendered static HTML and Angular code was loaded and injected progressively as the user interacts with the app. One key part of that demo was that code-splitting was happening at the component level to enable this progressive hydration. I haven't heard about it much since then though. Would this optional NgModule and standalone component enable this use case in the future? Hopefully in a more or less automated manner? An initial bundle size of 10kb is really attractive. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Same question here. I'm also wondering about the lazy loading. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
there's nothing in this proposal that implies Components and files to be 1-1, as far as I can tell, nor that you'd necessarily have to use a dynamic import directly - meaning you could do more complex/intelligent things in terms of loading components as your application required: {path:'/some/route/to/standalone',loadComponent:()=>someSmarterLoader('SomeComponent') or {path:'/some/route/to/standalone',loadComponent:()=>import('lazy-feature').then(m=>m.ComponentA) //lazy-feature.tsexport{ComponentA,ComponentB} |
BetaWas this translation helpful?Give feedback.
All reactions
👍 13
-
Yep,@robwormald it totally correct here - this proposal doesn't prescribe / implies single-file-components. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Re-reading questions / discussions here a couple of more clarifications: standalone components / directives and pipes don't force any particular file / packaged bundles layout. While it will be possible to have more granular bundles (one bundle per component), nothing in this RFC is prescribing / forcing it. It means that it is equally valid and possible to have one standalone component per bundle as well the entire bundle with the entire app. In short: with this RFC we will have more possibilities but nothing prescribes component-by-component bundling and loading. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
-
Could we have a setting in angular.json that sets/overrides the default standalone value? |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
I'd rather not have that: reading a component source code wouldn't be enough to know if the component is standalone or not. What would be nice OTOH is to be able to specify that |
BetaWas this translation helpful?Give feedback.
All reactions
👍 21👎 1❤️ 2🚀 2
-
Thanks for the suggestion@penfold. We discussed this while creating the design and concluded that we can't have default overrides because then the components would behave differently based on this hidden (located far away) configuration. What's worse, changing the config setting would completely change the semantics for many components (and potentially 3rd party components installed via npm). This would result in subtle runtime-only bugs that would cause your application to fall apart over time. For these reasons, the only default is the one set in the framework, and as documented in the RFC, there is a clear path towards changing this default in a safe way if we decide that that's the right thing for the ecosystem. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 11
-
Tooling section could mention possible migration schematics. Maybe language service should be leveraged during the migration to collect correct list of |
BetaWas this translation helpful?Give feedback.
All reactions
-
Good point,@minijus. I agree.@pkozlowski-opensource could we add that? We've discussed this, and there is a clear path forward for building schematics that will automigrate SCAM components to standalone components. In most cases it should be a safe and fully automatable migration. For non-SCAM components the migration is a bit trickier, but as you said, the tooling could figure out the imports and do other things, and then the developer could review and approve the migration component by component. So, yes! |
BetaWas this translation helpful?Give feedback.
All reactions
🚀 6👀 1
-
Mentioned potential use of schematics |
BetaWas this translation helpful?Give feedback.
All reactions
-
|
BetaWas this translation helpful?Give feedback.
All reactions
-
@JoelNietoTec can you please clarify what you mean by this? thank you |
BetaWas this translation helpful?Give feedback.
All reactions
-
I think he means that while ngModules aren't deprecated he would prefer to be explicit and have the flag. I would agree and that seems to be what's implied in the doc. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I'd say +1 for not using |
BetaWas this translation helpful?Give feedback.
All reactions
-
This is a great proposal and a great step in the right direction.
@Component({imports:[CommonModule,FormsModule,MatButtonModule,MatIconModule,MatToolbarModule,MatMenuModule,],standalone:true,selector:'my-comp',templateUrl:'./template.html',stylesUrl:['./styles.css'],}) Being able to import these from a constant in a separate file is good, however, it still means you're looking elsewhere for the dependencies, albeit more explicitly.
If a component states that it is @Component({providedIn:'root',selector:'hello-world',template:'<h1>Hello World</h1>'styles:['h1 { color: red; }']})exportclassHelloWorldComponent{}@Component({selector:'app',template:'<hello-world></hello-world>'})exportclassAppComponent{}bootstrapComponent(AppComponent); And if you wanted to include the component in a particular NgModule, you simply replace the
// difficult to reason aboutdeclarations:[AComponent],imports:[CommonModule,FormsModule,BComponent,MatButtonModule]// easier to reason about and helps separate out that BComponent is self-contained// whereas AComponent needs the Modules in the importsdeclarations:[AComponent],uses:[BComponent],imports:[CommonModule,FormsModule,MatButtonModule]
|
BetaWas this translation helpful?Give feedback.
All reactions
👍 9👎 5
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Great proposal 🚀. +1 for Auto-import the CommonModule. I think we can accept a little bit of magic if it means we won't have to write
-1 for Edit: How will this affect @angular/elements? Edit2: How will this affect routing? |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2👎 6😕 2❤️ 1
-
I agree 100%! Auto importing |
BetaWas this translation helpful?Give feedback.
All reactions
👍 7👎 6😕 1
-
Thanks for the feedback. The @pkozlowski-opensource it might be worth mentioning in the RFC that @angular/elements would be positively impacted by this proposal, without going into details. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2👀 1
-
Great stuff! I would stick to the name imports. deps would be the only abreviation in the decorator. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4👎 1😄 1❤️ 3
-
I agree on explicitly specifying imports. +1 on imports, it's instantly clear what it does and fits with the |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
I think this is a phenomenal proposal and am most excited for the ability to easily lazy load components at runtime and have them be split into their own bundle! My preference with regards to the how In the long run, I think splitting things like Thanks for all of your hard work on this proposal! |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3😄 1❤️ 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thanks for the note, Andy. I addressed this in an earlier comment. In short - this wouldn't work:#43784 (comment) - let's keep the discussion on that topic in that thread. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Great proposal! I am really looking forward to this. Some thoughts, questions, and feedback:
A big thank you for everyone's effort! I can't wait to see this sorted out and come to reality! 💖 |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4❤️ 3
-
One thing that came to mind (even though I know this is not gonna happen anytime soon), if we were to deprecate NgModule in the future, would we still have this opinionated style guide? Like if it's all just components, some architecture guidelines like "feature modules" will not exist. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 2
-
In Nx workspaces, we use a workspace library as an explicit architectural boundary. Depending on your definition, this proposal doesn't remove the need for feature modules because they often orchestrate routes and feature module injectors. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Yeah, but |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thanks a lot for this great RFC! Some remarks:
|
BetaWas this translation helpful?Give feedback.
All reactions
-
One capability that seems to be lost with standalone components, unless I'm missing something, is encapsulation, i.e. the ability to make some components only usable within a specific feature module/component. As far as I understand, as soon as a component is standalone, every other component/module of the application is able to import and use it, even though it has been designed to be used only as a part of another component or feature module. This is possible, and IMHO, quite useful, with modules, which can declare components and not export them, to keep them private, and thus easily modifiable/deletable with an impact limited to their declaring module. It would maybe be a good idea to be able to specify the authorized scope of a component, i.e. mark it as usable only in the template of some other components, or importable by only some other modules. |
BetaWas this translation helpful?Give feedback.
All reactions
👀 1
-
In Nx workspaces, we use a workspace library as an explicit architectural boundary. Each one having an explicitly defined public API with tooling to prevent deep or forbidden imports. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 7👎 1
-
@jnizet I hear you and you are right. At the same time it moves us closer to the JS ecosystem where you've got exactly the same problem of the "package private" members. As@LayZeeDK hinted I also believe that the proper solution is to have "package" / "module" internal exports but don't expose those as part of the "public API". |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
This is indeed a downside of using
The answer here is straightforward - hiding the component by not exporting it from the library entrypoint.
This is a little trickier, because such components/directives still need to be exported from the entrypoint (since they will be consumed in templates, albeit indirectly). One would have to use a similar trick as Angular, to export the component with a "private" name. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Maybe it would be nice to be able to opt-in to auto-importing |
BetaWas this translation helpful?Give feedback.
All reactions
👎 3
-
Let's keep it predictable and readable on the first try (without deep studying what combinations are in the play) as much as possible. It's one of the most valuable advantages of the Angular framework at all. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
-
I've seen a similar proposal in another thread but I feel like it doesn't add much in terms of readability and makes the code more confusing. If you need a set of imports that are shared between many or all components, it seems smarter to create a static array and import it as they show in the RFC. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thoughts:
I wonder about this, since this assumes you have access to the source code, which is the case for code you own but not dependencies. One thought might be mirroring the |
BetaWas this translation helpful?Give feedback.
All reactions
👍 13❤️ 5🚀 7
-
I agree about the first part, but I think at least a basic set of ghings like |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
@robwormald thnx for taking time to read / comment. Couple of comments:
Not sure I got what you mean, we must be crossing the wires somewhere. Needs more discussion / elaboration. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@pkozlowski-opensource I think what Rob means is that a library author can expose whatever he wants to expose in the docs of a library, which could mean the |
BetaWas this translation helpful?Give feedback.
All reactions
-
Right. The assumption here is that |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
I like |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Awesome feature, this will make applications much simpler. No more one module per component in reusable components :) About the auto import of CommonModule, I'd prefer it to be explicitly set or, as other already mentioned, an opt-in config in the angular.json |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
-
Lazy Side EffectsIn order to implement feature likesngrx's In the following example, (if everything is eager loaded), constSIDE_EFFECT=newInjectionToken('side effect');@NgModule()exportclassSideEffectModule{constructor(@Inject(SIDE_EFFECT)fns){for(constfnoffns){fn();}}staticforFeature({ sideEffect}):ModuleWithProviders<SideEffectModule>{return{ngModule:SideEffectModule,providers:[{provide:SIDE_EFFECT,useValue:sideEffect,multi:true,},],};}}@Component({standalone:true,imports:[SideEffectModule.forFeature({sideEffect:sayHello})], ...})exportclassHelloComponent{}functionsayHello(){console.log('Hello!')} How can we achieve the same result without modules and without changing anything in |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Valid point that you address related to the store. Edit: read your commonent after I replied - so, I agree, you already described that. 😉 |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Yep, this is a valid use-case and I've gotsome ideas on how to tackle it elegantly in the DI config (roughly similar to |
BetaWas this translation helpful?Give feedback.
All reactions
👍 5
-
I think it is important to have the routing and redux features available as the standalone Component feature gets available. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yes, I agree. Not strictly part of this RFC but I believe that having ideas of the module-less APIs for those use-cases is important. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 7
-
@pkozlowski-opensource, great to hear that - thanks a lot for your work. DI functions are really powerful for such use cases. We can even merge different 'multi' definitions across multiple DI nodes, which is quite nice for some implementations. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hello! First of all, this idea is amazing! Something that I want to know is if you are planning to support a "ComponentWithProviders" feature to configure standalone components. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Providers on components are already supported. Or do you mean something different? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Sorry, I forgot to add theModuleWithProviders link. And yes, I was talking about having something like this: @Component({standalone:true,///.....})classDateTimeFormComponent{staticconfigure(localeId:string) :ComponentWithProviders{return{component:DateTimeFormComponent,providers:[{provider:LOCALE_ID,useValue:localeId}]}}constructor(@Inject(LOCALE_ID)localeId){}}@Component({standalone:true,///.....imports:[DateTimeFormComponent.configure('fr')]})classMyParentComponent{} |
BetaWas this translation helpful?Give feedback.
All reactions
-
|
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Thnx for the reference@Maximaximum - I've linked this RFC from the mentioned issue. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
This is a really cool and useful feature. Thanks and Kudos! |
BetaWas this translation helpful?Give feedback.
All reactions
👎 3😕 1
-
This is a very interesting and well-documented proposal, congrats and many thanks to the writer 👏 👏 👏 I believe it goes in the good direction, some of the most confusing parts of Angular are related to NgModule (lazy loading, transitive dependencies, routing issues, DI, etc.). It would improve developer experience, reuse and sharing specially for simple GUI componentes, and one big point to me is that it could make testing easier and with less bolierplate. Regarding the feedback solicited:
My two cents ✌️ |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 2
-
@bbarry The problem with lazy imports in imports is that they are asynchronous (they create Promise) and NgModules themselves do not support asynchronous ModuleWithProviders/NgModules classes and here is the problem: how and when to resolve this Promise if the DOM rendering is done synchronously? |
BetaWas this translation helpful?Give feedback.
All reactions
-
It isn't without problems... the ones you describe are very likely solvable but would bring with them increased complexity and size of the framework. This wouldn't be about actually async loading most of the time; rather the value I think would be in identifying ideal splits for webpack. If there was a way for angular identify template content required for FCP vs not, something like this could be used to give angular the ability to further optimize the initial package size. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
@bbarry With ESM modules, top-level await is a thing. While the async support in angular poses a lot of extra challenges, this might be an option that can be considdered. (the wait will be runbefore angular starts its initialization. @pkozlowski-opensource, this might be something that needs some attention too. As I'm not 100% sure how it would pan out ;) import{Component}from'@angular/core';constlazyModule=awaitimport('./template-deps')const{ FooComponent, BarDirective, BazPipe}=lazyModule@Component({standalone:true,imports:[FooComponent,BarDirective,BazPipe],template:` <foo-cmp></foo-cmp> <div bar>{{expr | baz}}</div> `})exportclassExampleStandaloneComponent{} While the code for that seems reasonable, I'm not entirely sure this is a good idea. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Can foo-cmp component and bar directive be detected by compiler automatically without that boilerplate code? |
BetaWas this translation helpful?Give feedback.
All reactions
-
@SanderElias I think that might almost just simply work today? Babel/Webpack will convert that into something vaguely like: import{Component}from'@angular/core';awaitimport('./template-deps').then(({ FooComponent, BarDirective, BazPipe})=>{ @Component({imports:[FooComponent,BarDirective,BazPipe],template:` <foo-cmp></foo-cmp> <div bar>{{expr | baz}}</div> `})classExampleStandaloneComponent{} @Module(...)classExampleStandaloneHiddenModule{}return{ ExampleStandaloneComponent, ExampleStandaloneHiddenModule};}); the difficulty is that it is a import{enableProdMode}from'@angular/core';import{platformBrowserDynamic}from'@angular/platform-browser-dynamic';import{environment}from'./environments/environment';const{ AppModule}=awaitimport('./app/app.module');if(environment.production){enableProdMode();}platformBrowserDynamic().bootstrapModule(AppModule).catch((err)=>console.error(err)); (I still don't know if this is a "good idea.") You would need a custom webpack configuration to enable top level awaits (custom-webpack fromhttps://github.com/just-jeb/angular-builders can probably do it). @vecernik there needs to be some way for the angular template compiler to know which file contains the component it should load for the syntax |
BetaWas this translation helpful?Give feedback.
All reactions
-
While we think about naming of things and how all of this will be documented, will the group ofcomponents, directives, and pipes still be referred to asdeclarables? Can they still be called declarables if they may not be declared in NgModule anymore? @Component{selector: ...,standalone:true,uses:[declarables], ...}exportclass ... |
BetaWas this translation helpful?Give feedback.
All reactions
-
No, I don't think we would callall components / directives / pipes "declarables". Standalone components / directives / pipes would have to be excluded from the "declarables" set. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yeah I agree that it would be wrong to call them declarables. I'm trying to think if there's another good name for that group so that in documentation and speech we don't have to keep repeating "components, directives, and pipes". Unfortunately I don't have a good suggestion at the moment. The meaning of the name should convey "the things we use in templates". |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Couldn't standalone components be considered as auto-declared (even they are not explicitly declared in a module), and so keep naming them as declarables? Just to keep things simple... |
BetaWas this translation helpful?Give feedback.
All reactions
-
As someone who's been using SCAMs for some time now, standalone components make a lot of sense and will be awesome to have. As for auto-importing |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
just an idea that possible to disable (enable by default) the following example: @Component{selector: ...,imports:[CommonModule.disable(),ngFor, ....],standalone:true, ...}exportclass ... |
BetaWas this translation helpful?Give feedback.
All reactions
-
An idea to give the option to add |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I'm looking forward to seeing this proposal implemented in my projects 👍 Here's my solicited feedback:
|
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
What if you're creating a standalone pipe or directive? Most likely it won't need |
BetaWas this translation helpful?Give feedback.
All reactions
-
If I don't need anything from CommonModule, then I wouldn't import it at all. And if I need only one thing from CommonModule then I'd import it all for the convenience of not having to remember which directives is part of which module. And all of that with only a very minimal impact on compilation time, and zero impact on runtime. That seems like an acceptable balance between convenience and performance. |
BetaWas this translation helpful?Give feedback.
All reactions
-
You're right, I misread your comment. I thought you advocated for auto-import of |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
how about @standalone() |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1👎 6🚀 1
-
I forgot to say: personally I would prefer explicit imports for Can't wait until the |
BetaWas this translation helpful?Give feedback.
All reactions
-
This looks awesome. This can't happen quickly enough. Double thumbs up from me. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
Nice article. What if we forget about NgModule al together and let the compiler detect components and directives from its template and locate and use them from sources? It would greatly simplify the Angular mental model and ease the pain for newcomers. |
BetaWas this translation helpful?Give feedback.
All reactions
-
It's been discussed by the Angular team to make the Angular Language Server smarter so that it suggests component imports based on its template. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
Is Language Server also used for dev/prod builds? |
BetaWas this translation helpful?Give feedback.
All reactions
-
No, this would probably be something like fixers in your editor. |
BetaWas this translation helpful?Give feedback.
All reactions
-
@vecernik It's crucial to let the developer decide which directives/components/pipes to use in each specific case. You might have multiple components that have the same selector, and it's extremely important to let YOU decide which specific directive/component/pipe to use. Therefore, intellisense should (ideally) be able to make suggestions for you, but you should declare the dependencies explicitly. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Are there any chances that this will be included into the Angular v14 release? |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2👀 3
-
tl;dr; thank you for all the feedback - our intention is to proceed with the design described in this RFC. First of all we would like to thank everyone who commented on, or otherwise engaged in the discussion on this RFC. We had over 140 comments from more than 60 people on this RFC aloneplus additional conversations through other channels (social media, meetups, conferences). We were blown away by the quality and depth of the discussion. Thank you! Based on all the comments and feedback we believe that the design was well understood and received. Our interpretation is that the Angular community supports our intention of moving the framework in the proposed direction. And critically, we haven't seen any use-cases or technical constraints that would "break" the design. We've solicited feedback for some specific design questions in this RFC and your input was very valuable. Incorporating this feedback in our design, we intend to:
In your feedback, you raised several important questions that need additional design consideration:
Based on your feedback, we are confident enough in the core design of standalone components to proceed with implementation, but we will also embark on designing additional APIs and functionality when needed. |
BetaWas this translation helpful?Give feedback.
All reactions
🎉 2
