NativeScript/nativescript-angular

ngFor inside StackLayout is displayed as last component after building apk

anoggi opened this issue · 1 comments

Environment

  • CLI: 9.1.1
  • Android Runtime: 6.5.3
  • NativeScript-Angular: ~9.0.0
  • Angular: 9.1.1

Describe the bug
I have a small view with a StackLayout. When using tns preview the components inside are displayed as expected in the order specified. However, when using the apk, the CheckBoxes are displayed as last component of the StackLayout. The reason seems to be the use of ngFor.

Here are two screenshots illustrating the issue:

Correct behavior when using tns preview

Incorrect behavior when using apk

To Reproduce

<app-action-bar title="{{getTitle()}} - Lernen"></app-action-bar>

<StackLayout>

    <Label text="{{currentQuestion.question}}" textwrap="true"></Label>

    <CheckBox *ngFor="let answer of this.userAnswers" text="{{answer.answer}}"></CheckBox>

    <Button text="Weiter!"></Button>

    <Button text="Feedback"></Button>

</StackLayout>

Expected behavior
apk behaving like in the first screenshot (with tns preview)

This issue was fixed in @nativescript/angular 10.1.4 and 10.1.5, see https://github.com/NativeScript/nativescript-angular/blob/master/CHANGELOG.md#1015-2020-09-21

Preview is using nativescript-angular >= 10.1.5, which is why the error is not occurring.