Currently, I am facing a challenge with displaying a specific div
in my component
template only if any incoming messages contain the TYPE_OTHER
property. With numerous variations of the TYPE_OTHER
identifier, I am pondering on creating a condition that can identify that particular aspect of the property. However, I am uncertain about how to proceed and feel overwhelmed by trying to use a combination of ngFor
and ngIf
.
This is the model I am working with:
export enum MessagesType {
TYPE_PRIMARY = "TYPE_PRIMARY",
TYPE_SECONDARY = "TYPE_SECONDARY",
TYPE_OTHER_1 = "TYPE_OTHER_1",
TYPE_OTHER_2 = "TYPE_OTHER_2",
TYPE_OTHER_3 = "TYPE_OTHER_3",
TYPE_OTHER_4 = "TYPE_OTHER_4",
TYPE_OTHER_5 = "TYPE_OTHER_5",
TYPE_OTHER_6 = "TYPE_OTHER_6",
TYPE_OTHER_7 = "TYPE_OTHER_7",
TYPE_OTHER_8 = "TYPE_OTHER_8",
TYPE_OTHER_9 = "TYPE_OTHER_9",
TYPE_OTHER_10 = "TYPE_OTHER_10",
}
Template Structure:
<div class="show-if-type-other" *ngIf="
// Condition: display this div if message.type contains 'TYPE_OTHER'
">
<p>{{ message.type }}</p>
</div>