Skip to content

Angular 9: Using ngIf changes order of children inside a StackLayout #2176

Closed
@OliverNiebsch

Description

@OliverNiebsch

Environment

  • CLI: 6.7.4
  • Cross-platform modules: 6.5.0
  • Android Runtime: 6.5.1
  • iOS Runtime: 6.5.1
  • NativeScript-Angular: 9.0.0
  • Angular: 9.1.0

Describe the bug
After upgrading from Angular 8 to Angular 9: When using *ngIf on a component that's together with other components wrapped by a StackLayout, the component with ngIf is always added as the last child when the Page is rendered.

<StackLayout>
    <Label text="Line 1"></Label>
    <Label text="Line 2" *ngIf="true"></Label>
    <Label text="Line 3"></Label>
</StackLayout>

Screenshot

To Reproduce
Just start the app from the sample repository.

Expected behavior
"Line 2" is between "Line 1" and "Line 3". ngIf does not change the order of the elements.

Sample project
See here

Please ask when something is left uncleared. Thanks in advance!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions