Configure the Demo widget

The Demo widget is not configurable by default. However, you can make it configurable by doing the following:

In the widget folder, open the config.json file in a text editor. Add some JSON-structured text so that you can pass the config to your widget.


Alter the HTML template to use the config from your config file.

    <div>I am a demo widget.</div>
    <div>This is configurable.[${config.configText}]</div>

Now the Demo widget looks like the following:

Demo widget is configurable

The config.configText marker in the template is automatically replaced with the values from the config.json file.

You can use this.config.configText in your Widget.js file to access the config value.