From df1651db94e69f2977bc0344864ec061b56b104e Mon Sep 17 00:00:00 2001 From: Michael Ragazzon Date: Tue, 4 Apr 2023 14:32:49 +0200 Subject: [PATCH] Document data-alias view --- pages/data_bindings/views_and_controllers.md | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/pages/data_bindings/views_and_controllers.md b/pages/data_bindings/views_and_controllers.md index 4e35e46..73eb39c 100644 --- a/pages/data_bindings/views_and_controllers.md +++ b/pages/data_bindings/views_and_controllers.md @@ -28,6 +28,7 @@ The following table lists all built-in data views and controllers in RmlUi, alon | [For](#data-for) | View | data-for | [iterator_name], [index_name] : [data_address] | [1] | | [Rml](#data-rml) | View | data-rml | [data_expression] | | | [Text](#data-text) | View | N/A | N/A | [2] | +| [Alias](#data-alias) | View | data-alias-[alias_name] | [data_address] | | | [Value](#data-value) | Two-way | data-value | [data_address] | [3] | | [Checked](#data-checked) | Two-way | data-checked | [data_address] | [3] | | [Event](#data-event) | Controller | data-event-[event_type] | [assignment_expression] | | @@ -192,6 +193,37 @@ Evaluates any data expression inside double curly brackets {{ }} encountered in This data view is automatically added whenever double curly brackets are encountered in the text and should not be added as an attribute. +#### Alias +{:#data-alias.data-desc} +`data-alias-[alias_name]="[data_address]"` +{:.data-attr} + +Creates a new alias variable at the given scope, allowing the stated data address to be referred to by its alias name. + +This allows [templates](../rml/templates.html) to be used as reusable components within data models. By wrapping the inline template in an element that defines variable name aliases, the template can refer to any outside variable by a fixed name. + +To illustrate, consider the following template. + +```html + +``` +This template can then be used with different variables as follows: +```html +
+