Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Service Portal widget onload DOM manipulation

xiaix
Tera Guru

In a Service Portal Widget, how do I manipulate the DOM once the HTML template has rendered?   (onload)

Thanks!

5 REPLIES 5

Paul Kunze
Kilo Sage

Hi, an easy way that works is to utilize the ng-init directive. You can include a function there which will be executed once when the DOM and AngularJS are loaded.

Here is an example:

<div id="container" ng-init="myFunction()">
</div>

You can write something like this in the Client Script:

api.controller=function($scope) {
	$scope.myFunction = function() {
		console.log('DOM has loaded');
	}
}