Skip to main content
6-Contributor
July 7, 2023
Solved

Is there a better way to exchange FILEURL with JS

  • July 7, 2023
  • 1 reply
  • 1652 views

Is there a better way to exchange FILEURL with JS?

 

I was able to change it by creating a global variable and linking it to the file url path, but I wonder if there is a more optimized way?

 

NOW: $scope.app.params.stepPDF = "app/resources/Uploaded/Procedimento1.PNG";

 

Best answer by sgreywilson

Binding to an app param is good and can help if you are having UI update issues. Using app.param is a useful approach.

 

Going forward I have started using 

 

$scope.setWidgetProp("Your widget name" , "attribute name" , value)

 

and

 

$scope.getWidgetProp ("Your widget name" , "attribute name")

 

as opposed tp

 

$scope.view.wdg["Text-1].text = "some text";

 

The set and get are higher functions and do additional work  

 

1 reply

16-Pearl
July 7, 2023

You could do setWidgetProp but am unsure of the use model below shows the syntax where src is the property name 

 

$scope.setWidgetProp("YourWidgetStudioID", "src", "app/resources/Uploaded/Procedimento1.PNG");

 

Maybe we need a little more info on what your are trying to achieve.

 

 

6-Contributor
July 7, 2023

I am changing the fileurl of a 2D "File" widget according to the switch case, as I am currently doing it is working and it works with a global variable linked in the fileurl, but I wonder if there is any other way to conform to good usage practices.

16-Pearl
July 7, 2023

Binding to an app param is good and can help if you are having UI update issues. Using app.param is a useful approach.

 

Going forward I have started using 

 

$scope.setWidgetProp("Your widget name" , "attribute name" , value)

 

and

 

$scope.getWidgetProp ("Your widget name" , "attribute name")

 

as opposed tp

 

$scope.view.wdg["Text-1].text = "some text";

 

The set and get are higher functions and do additional work