【发布时间】:2019-09-12 09:05:27
【问题描述】:
我的项目有一个大问题。我正在使用仅在 android 平台上工作的 *ngIf。在 iOS 平台上不起作用。
我在 HTML 中有这段代码:
<GridLayout columns ="auto, auto" rows="*" (tap)="open()">
<StackLayout col="0" row ="0">
<label text="SomethingText"></label>
</StackLayout>
<StackLayout col="1" row ="0" *ngIf="sub">
<label text="Right"></label>
</StackLayout>
<StackLayout col="1" row ="0" *ngIf="!sub">
<label text="Bottom"></label>
</StackLayout>
</GridLayout>
在 TS 我有:
sub: boolean = false;
public open() {
this.sub= !this.sub;
console.log('value',this.sub)
}
当我点击视图中的函数时显示不正确,显示为空、右、下、下等。
但控制台在每次点击时显示正确的 true , false 。
请问,你能问我如何解决这个问题吗?
【问题讨论】:
-
你能分享一个可以重现问题的 Playground 示例吗?
标签: ios angular nativescript angular-ng-if