HealthService Example

Here’s a minimal but complete example of a Lightning web component that uses HealthService to write a weight record to the device and read the weight history back again.

The component’s HTML template is minimal, with a button to write a weight record, a button to read weight history, and a place to display results.

Note the use of the for:each directive and nested template tag to iterate through the list of weight records.

This example writes a sample weight record to the device, and then reads the weight history back and displays it. In a real component, the weight value comes from a Salesforce record or user input.

See Also