Comments (2)
Hey, thanks for providing reproduction repo - it was very useful to debug the issue!
I have found the problem and it lays down in a way you process input changes or rather using a setter instead of a OnChanges
lifecycle hook =)
The reason setters don't work in your case is that inputs are set on dynamic components before the outputs are subscribed and if you know observables will miss any events that happened before the subscription, and since you are setting the id in the setter which triggers the loading state change the output will miss this first event and only work on the subsequent events.
So to fix your issue you could either use OnChanges
hook to set the id as this will delay the event until after outputs were processed or you can add a timeout when setting id (I've added the timeout just to check and it fixed the issue).
I would recommend/prefer to always use OnChanges
hook as it is semantically cleaner and also it always guarantees that all initialization logic of your constructors/props is executed but you are free to do as you please 😊
With regards to this issue I believe we could reverse the order of processing first outputs and then inputs to make it consistent with what seems like Angular is doing under the hood but to be hones I would rather not rely on the order of what is processed first/last...
What do you think?
from ng-dynamic-component.
I'm closing this issue as it's outdated and no fix is planned for it.
If you want to reopen the discussion please feel free to open a new issue.
from ng-dynamic-component.
Related Issues (20)
- Question about dynamic templates HOT 2
- Support RxJS ^7.4.0 HOT 2
- Support for Angular 14 HOT 7
- Need add rxjs 7 support for version 9.x.x HOT 14
- Building app with angular 13 leads to compile error HOT 6
- Cannot access 'IoService' before initialization HOT 8
- Backwards compatibility with Angular 13 in minor update v10.x.x is broken HOT 1
- [Question] How to call functions mentioned in dynamic components HOT 2
- Support for Angular 15 HOT 4
- Ability to provide ngModuleRef when creating component HOT 4
- [BUG] `IoEventContextToken` is not exported HOT 3
- Unknown input error after updating from no-barrels version [Bug] HOT 1
- Property 'withComponents' does not exist on type 'typeof DynamicModule'. HOT 1
- Support angular 14 HOT 1
- Component not support nested HOT 2
- [Bug] HOT 2
- Support for Angular 16 HOT 3
- Angular 17 support HOT 4
- [Bug] Remove ndc-dynamic from the dom using flex gap or add display none HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-dynamic-component.