jquerycssjquery-pluginsorgchart

Terinary operator to add user symbol


how can add <i class="fa fa-users symbol"></i> on manager box to show user symbol icon in Maansger2nodes below is the picture

enter image description here

tying this line where checking ${data.tcount}>0 but it shows in string

${data.tcount}>0?<div class="title">${data.title}<i class="fa fa-users symbol"></i></div>:<div class="title">${data.title</div>

data bind node template where need to add terinary operator

var nodeTemplate = function(data) {
                    return `
            
                   <div class="title">${data.title}</div>
                   <div class="content">${data.name} </br>${data.MainRole}</br>${data.Country} </div>
            
         
          
           `;
        }

Solution

  • I think you mean something like this?

    <div className="title">{data.title} {data.tcount > 0 && <i className="fa fa-users symbol"></i>}</div>