-
-
Notifications
You must be signed in to change notification settings - Fork 241
Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
- CLI: 7.2.1
- Cross-platform modules: 7.1.4
- Android Runtime: 8.0.0
- iOS Runtime:
- Plugin(s):
- NativeScript-Angular: ~11.0.0
- Angular: ~11.0.0
Describe the bug
Using ngFor in child components (embedded via template selector in HTML) when child component is initialized with a delay,
such as with ngIf or ngSwitch with a false initial value, is broken. The loop executes the correct number of times, but every item is either null or undefined and other loop variables are wrong too, e.g. index is -1 for every iteration.
Edit: After more testing, it seems you don't even need a child component. If ngFor array is set from a promise, ngFor breaks as described.
To Reproduce
Expected behavior
Sample project
https://github.com/OzymandiasTheGreat/nativescript-ngfor-bug
It's the ng-blank template with an additional child component. Just running the example prints what I'm describing.
Additional context