1
\$\begingroup\$

I am displaying the following information in angular 8 application. I need to display only the partnerName if it exists.

<h1>Financial Game Plan<br>of <span>{{ name }} and {{ partnerName }} </span> for {{ currentDateString }}</h1>

I have done the following. Could you let me know if it is correct?

TS

 this.name = factFindService.dataModel.client.firstName + ' ' + factFindService.dataModel.client.lastName;
      if(factFindService.dataModel.partner) {
        this.partnerName = factFindService.dataModel.partner.firstName + ' ' + factFindService.dataModel.partner.lastName;
      }

HTML

 <h1>Financial Game Plan<br>of <span>{{ name }} <span *ngIf="partnerName"> and {{ partnerName }} </span> </span> for {{ currentDateString }}</h1> 
\$\endgroup\$
  • \$\begingroup\$ The one issue that I see is that and styling is not looking similar to of as it could be probably because of is not in the span tag \$\endgroup\$ – Tom Dec 16 '19 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.