This is the markup I want to place the returned value:
<h2>{{getSelectedUserName}}</h2>
This is the function I want to use, which returns a string:
public getSelectedUserName(): string {
let firstName = this.selectedUser.name.split("\\s+")[0];
console.log(this.selectedUser.name.split("\\s+"));
console.log(firstName);
return firstName;
}
You're not calling the function. You need
{{ getSelectedUserName() }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With