Widget - script event when a form finishes loading

georgechen
Kilo Guru

Hi folks,

just wondering if anyone happen to know any events in a Service Portal client script that get fired as soon as the form finishes loading,

I've been looking into

$timeout(function() { }, 1500)   // if the ms 1500 not given, it doesn't seem to fire at all, however, this works on short form, not on relatively longer form as it can take more than 1500ms to load.

$scope.$on('spModel.gForm.initialized',   // not so sure what is this, but looks like something I am after?

$scope.$watch(function() {}   // it appears this get fired on certain events I am not too sure of, but if putting my scripts in this block it seems to work.

If anyone could advise any more events that I should be consider, it would be appreciated.

Thanks,

2 REPLIES 2

Rahul Gupta
Tera Contributor

Did anyone got the answer to this one ?...i am also having the same issue ...

Kit Cheong
Giga Guru

This is the closest method I could find to identifying when AngularJS has finished processing the page load.
I know it's not rock-solid method.

Service Portal Widget Client Script:

	$scope.$watch('$viewContentLoaded', function() { 
		$timeout(function() {
			//Code to run
		}, 0);    
	});