As a beginner to nativescript, I am struggling to properly retrieve the stacklayout id. Currently, I am working on Angular2 with typescript and have attempted the following code snippet. Regrettably, I encountered this issue in the command prompt:
JS:Error TypeError : Cannot set property 'visiblility' of undefined Context[object Object]
Html Structure:
<StackLayout #target visibility="collapse" id="stackLayout"> ..... </StackLayout>
I aim to change the visibility of the stacklayout programmatically upon clicking a button.
Typescript Implementation:
public stackLayout: StackLayout;
onTap(args: EventData) {
this.animate();
}
public animate() {
this.stackLayout.visibility = "visible";
}