Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Embed a widget multiple times with custom options

Log in to subscribe to topics and get notified when content changes.

Embed a widget multiple times with custom options

Use the steps in this example to embed the cool clock widget multiple times using different custom options.

Each instance of the cool clock widget has a different time zone and title. Open the cool clock widget in the Widget Editor to see an example of how widget options are used in the HTML template and the Client Script. For more information on widget options, see Widget instance options.

Figure 1. Cool Clock widget with Options highlighted
Cool Clock widget with c.options.title, c.options.c_color, and highlighted
  1. Clone the Cool Clock widget with the name Embedded clock
  2. Replace the code blocks with the following:
    HTML Template
    <div class="panel panel-default">
      <div class="panel-heading">Time across the US</div>
      <div class="panel-body">
        <div class="row">
          <div class="col-sm-3" ng-repeat="myClock in">
            <sp-widget widget="myClock"></sp-widget>
    .panel {
        margin-top: 10px;
    Client Script
    function() {
        // nothing to do here...
    Server Script
    (function() {
        var options = [
            {zone: "America/Los_Angeles", title: "San Diego"},
            {zone: "America/Denver", title: "Denver"},
            {zone: "America/Chicago", title: "Chicago"},
            {zone: "America/New_York", title: "New York"}
        data.clocks = [];
        for (var i in options) {
            data.clocks.push($sp.getWidget("widget-cool-clock", options[i]));

Each instance of the clock in the embedded clock widget appears with a different time zone.

Figure 2. Sample clock options
Embedded clock with four embedded widgets with four different time zones