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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How set image source from JS

jmikesell
16-Pearl

How set image source from JS

I would like to set the image source in JS but i can't seem to get it to work. I have tried all of these but non seem to work. But they also do not produce an error in the console.

 

 
$scope.view.wdg['image-1']['source'] = 'tech1en.png';
$scope.view.wdg['image-1']['source'] = 'resources/Uploaded/tech1en.png';
$scope.view.wdg['image-1']['source'] = 'app/resources/Uploaded/tech1en.png';
If i use an application parameter to store the image source value (and then change that parameter with JS) and link that to the image source in Studio it works but this is an extra step i would like to avoid.
ACCEPTED SOLUTION

Accepted Solutions
ytella
17-Peridot
(To:jmikesell)

Hi @jmikesell,

 

Please use the below line to set the image source using JS for a mobile AR experience :


       $scope.view.wdg['image-1']['imgsrc'] = 'app/resources/Uploaded/download.jpg';

 

Let me know if this helps!

View solution in original post

3 REPLIES 3

I've used this code successfully for setting the source for 3D images in experiences on the HoloLens:

 

$scope.setWidgetProp("instruction_image", "src", "app/resources/Uploaded/finished.png");

 

Hope this helps.

 

Allan

ytella
17-Peridot
(To:jmikesell)

Hi @jmikesell,

 

Please use the below line to set the image source using JS for a mobile AR experience :


       $scope.view.wdg['image-1']['imgsrc'] = 'app/resources/Uploaded/download.jpg';

 

Let me know if this helps!

MA8731174
14-Alexandrite
(To:ytella)

This is working perfectly fine! Thanks @ytella 

Announcements

Top Tags