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

how to start service of scan widget on programmatically

SOLVED
Highlighted
jry
Participant

how to start service of scan widget on programmatically

I'd like to invoke the start scan service automatically when my view is loaded. I try to use the code following :

 

$scope.init = function(){
$scope.app.fn.triggerWidgetService('scan-1','startscan');
};

angular.element(document).ready($scope.init);

 

but it's not working.

it's working when I use with show popup service or another service but only scan service is not working.

I'll be happy if someone can help me. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to start service of scan widget on programmatically

but I think your code should also work bacause the document ready is comming nearly / a little bit earlerer before '$ionicView.afterEnter' and  I think there all 2d should be  already loaded.

May be, there is only the service name the problem ->'startScan' instead of 'startscan'

View solution in original post

3 REPLIES 3

Re: how to start service of scan widget on programmatically

Hi @jry ,

I had in the past a project where the scan widget (widget id scan-1) was in a popup widget id = popup-1 

On start I did show the popup and start scan with the following code:

 

$scope.$on('$ionicView.afterEnter', function() {
$timeout($scope.$root.$broadcast('app.view["Home"].wdg["popup-1"].svc.showpopup'),100);
$timeout($scope.$root.$broadcast('app.view["Home"].wdg["scan-1"].svc.startScan'),500)
});

 

Important is to call the code when 2d is already initialized - this is guaranteed by the event  '$ionicView.afterEnter'

I think it should work also without popup- you can try

Re: how to start service of scan widget on programmatically

but I think your code should also work bacause the document ready is comming nearly / a little bit earlerer before '$ionicView.afterEnter' and  I think there all 2d should be  already loaded.

May be, there is only the service name the problem ->'startScan' instead of 'startscan'

View solution in original post

Re: how to start service of scan widget on programmatically

Dear @RolandRaytchev ,

 

now the problem is fixed!!

it looks like a stupid problem so I just startscan instead of startScan.

 

Thank you so much!! 

Announcements
Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection