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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Is there a better way to exchange FILEURL with JS

EB_9781810
6-Contributor

Is there a better way to exchange FILEURL with JS

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";

 

ACCEPTED SOLUTION

Accepted Solutions

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  

 

View solution in original post

3 REPLIES 3

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.

 

 

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.

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  

 

Announcements

Top Tags