Embedded widgets API reference

Use the widget API to create an Angular directive.

Client Side

spUtil.get() - Get a widget model via client script
spUtil.get("widget-sc-cat-item", {sys_id: "your_catalog_item_sys_id"}).then(function(response) {
    c.catalogItemWidget = response;
});
Parameters:
(string) widget_id
Can be a widget_id or widget sys_id.
(object) data
An object to post to the widget's server script. Refer to this object as input in your server script.

Callback:

The callback function is called when the widget model is ready. The response object contains the full widget model.

Server Side

$sp.getWidget() - Get a widget model via server script
data.catalogItemWidget = $sp.getWidget("widget-sc-cat-item", {sys_id: "your_catalog_item_sys_id"});
Parameters:
(string) widget_id
Can be a widget_id or widget sys_id.
(object) options
An object to pass to the widget's server script. Refer to this object as options in your server script.
Note: Any options passed into this function will only be available in the embedded widget's server script on the first execution of that script. Any subsequent calls into the server script from the embedded widget will not contain the object properties passed in.