Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Add information about ignoreTmpls property #6873

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ As a result, a template literal used in the value of one the objects listed abov

Perhaps the most important part of template literals in Magento is the `$` object that can be used inside expressions. (Remember an expression is anything within `${ }`.) The `$` provides access to the `this` context in the JavaScript class where the template literals are. To take it a step further, `this` (and the related `$`) is the KnockoutJS context for the template that can be bound to the UI Component. This object should not be confused with the `$` that marks the beginning of an expression. The `$` object can only appear inside of an expression. Here is an example: `${ $.submitUrl }`: the `$` references the current KnockoutJS context, and `.submitUrl` will return the `provider` property from that object.

### The `ignoreTmpls` property

The `ignoreTmpls` property is an object that prevents template processing for selected properties.

```javascript
return Element.extend({
defaults: {
value: 'some component value',
propertyIgnoreTempls: '${ $.value }', // template literals will be ignored for this property
ignoreTmpls: {
propertyIgnoreTempls: true
} // ignoreTmpls object contains a list of properties with template literals ignored
}
});
```

## Example

Perhaps the most useful aspect of template literals is the ability to access other UI Component JavaScript classes in the registry so we will use this as an example. First, there are a few things to explain.
Expand Down