Dynamically populating label parameters

You can provide a string with placeholders, which are replaced by substitute values at runtime.

Let's create a label with the value Hello {0} and name it greeting. You can dynamically replace {0} with an attribute value. The syntax uses the format function, as follows:

{!format($Label.c.greeting, v.name)} ;//here name is the attribute on the component

Get Learning Salesforce Lightning Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.