0

I am using MGT (Microsoft Graph Toolkit) and was wondering if it was possible to slice an attribute. Here is my code:

                <mgt-person person-query="me">
                  <template>
                   <div>
                    {{person.displayName}}
                   </div>
                  </template>
                <template data-type="loading">
                   Loading
                </template>
                 </mgt-person>

person.DisplayName Returns : "Smith, John"

How do just get the first name from this? I want to slice out the last name and the ",".

I know {{person.givenName}} will give you the first name but for various reasons, some users have a different name in their display name they prefer to be called by.

Please help.

1 Answers1

0

You could use js to achieve this:

person.displayName.split(",")[0]
Michael Han
  • 3,475
  • 1
  • 6
  • 8