1

I have created a lightning web component to show several related object tables on a detailpage. Above one of the tables I want to show some extra specific data related to one of the object tables.

We can use <template if:true={display}>. Since I am using the same component on the same page. On rendering 1 specific component I would like to show extra data.

Is there a binary rendering condition to achieve this? Something like:

<template if:true={{object}=='Contact'}>

I thought of a boolean as property on the component but then if I would like to show other data for another table I would still have to Identify which table. Thanks in advance

0

1 Answer 1

3

you will want to use a getter in order to compute an expression and return a boolean value. For ex.

js file

get verifySomething() {
        return prop.object === 'Contact'
    }

template

<template if:true={verifySomething}>
2
  • So binary rendering is not possible?
    – Thomas
    Oct 22, 2021 at 13:38
  • you cant evaluate expression in templates as you could in AURA
    – glls
    Oct 22, 2021 at 13:43

Not the answer you're looking for? Browse other questions tagged .