atomic-field-condition (Deprecated)
atomic-field-condition (Deprecated)
|
|
Atomic v1 has been deprecated. We recommend using the latest version of the Coveo Atomic library. |
The atomic-field-condition component takes a list of conditions that, if fulfilled, apply the template in which it’s defined.
The condition properties can be based on any top-level result property of the result object, not restricted to fields (for example, isRecommendation).
Best practices
Usage notes
-
The
must-matchandmust-not-matchmarkup attributes require kebab-case when referring to a result property whose name is in camelCase. For example, theisRecommendationproperty should be written asis-recommendation.<atomic-field-condition must-match-is-recommendation="true"> <!-- ... --> </atomic-field-condition> -
Regardless of whether its condition is satisfied, the
atomic-field-conditioncomponent will render all its children and itself. If its condition isn’t satisfied, it will then remove itself and its children from the DOM. For example, consider the following:<atomic-field-condition if-not-defined="thumbnailurl"> <atomic-result-icon class="icon"></atomic-result-icon> </atomic-field-condition> <atomic-field-condition if-defined="thumbnailurl"> <atomic-result-image field="thumbnailurl"></atomic-result-image> </atomic-field-condition>When the
thumbnailurlfield isn’t defined on a result, theatomic-result-iconwill be rendered as expected. However, theatomic-result-image(nested in the secondatomic-field-condition) will also be rendered and subsequently removed from the DOM. This will produce a console warning, as thethumbnailurlis undefined when it’s referenced by theatomic-result-imagecomponent.
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
|
A function that must return true on results for the result template to apply. For example, a template with the following condition only applies to results whose |
|
|
|
|
|
Verifies whether the specified fields are defined. |
|
|
|
|
Verifies whether the specified fields are not defined. |
|
|
|
|
The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose |
|
|
|
|
The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose |
|
|