Skip to main content
14-Alexandrite
July 10, 2018
Solved

How to change View with JavaScript?

  • July 10, 2018
  • 2 replies
  • 6658 views

Hello,

 

I know that I can navigate to other view with button event.

But I need to create a function which change view only if something happen.

 

So how can I change view with a JavaScript?

 

Thanks for every answer.

 

Tomas

This topic has been closed for replies.
Best answer by Giuseppe_Fiore

make a new view 'prova'

and make a script :

 

$scope.go=function() {

twx.app.fn.navigate("prova");
};

 

assign go to click event 

 

 

Giuseppe

 

2 replies

15-Moonstone
July 10, 2018
$scope.app.fn.navigate('Enter View Name Here'); //navigate to other View
15-Moonstone
July 10, 2018

make a new view 'prova'

and make a script :

 

$scope.go=function() {

twx.app.fn.navigate("prova");
};

 

assign go to click event 

 

 

Giuseppe

 

12-Amethyst
September 20, 2018

Hi,

 

I am having issues trying to replicate this behavior and was wondering if you can see what I'm doing wrong? I am working on Hololens but I don't believe this should affect anything.

 

I have 2 'views', the first is 'Home' (The name, Studio ID and friendly name are all the same) and the second 'H&S' (again the name, Studio ID and friendly name are all the same)

 

In the Home.js I have:

$scope.go=function() {
twx.app.fn.navigate("H&S");
};

On the swipe right application event (I have tried on a click event as well) I call the function:

go();

But the scene does not change in the preview. 

 

Any advice would be great. 

Thanks

15-Moonstone
September 20, 2018

for the Hololens modify the script in :

 

 

$scope.app.go=function() {
twx.app.fn.navigate("H&S");
};

 

and the call 

 

app.go();

 

I hope to help you

 

Giuseppe