cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

List of all Views in array

whity
16-Pearl

List of all Views in array

Hello everyone,

 

I have programmed an app, that checks the code, that is scanned and looks for a view that complies to that. Right now, I write a list of the views by hand, but it would be nice to have them in an automaticly generated array. Does anyone know how to get that?

 

//first create an app parameter (e.g. ScannedCode) and bind the scanned value to it.

var ScannedVal = $scope.app.params.ScannedCode;
var arr = ['Home', 'help','about','users'];  //this should be generated automaticly
var arroutcome = arr.includes(ScannedVal);  //checks if ScannedVal is part of the array
if (ScannedVal!=undefined && arroutcome==true){
twx.app.fn.navigate(ScannedVal);
}

else....

 

Thanks and greetings

whity

2 REPLIES 2

i'm not sure this is possible, this lince should get you an array of view names:

var views = Object.keys($scope.app.view);

But the view names are not populated until you touch them. For example I have an experience with views 'Home', 'Parts' and 'view3'. When you first go in the above line will return ["Home"]. If you then go to the 'Parts' view the same will return ["Home", "Parts"] even if you come back to 'Home' it will still list those two view. Then if you go to 'view3' after that you will get ["Home", "Parts", "view3"]. Something is updating the view object dynamically.

thanks for your answer:)

 

Having a list of all views could be a useful thing. Maybe this is something for PTC to keep in mind for future releases. @tmccombie 

Announcements

Top Tags