Linked Questions

Popular Questions

I'm new in angular and don't know much about it yet. I am showing a list of people in my angular app. And I want to show first letters of their first name and last name as DP if no picture found for that person. My code looks like below:

<div class="people" *ngFor="let user of users">
    <div class="s-profile-icon">
        <img src={{user.picture}} alt="Profile" />
    <div class="s-name">

Well I know I can use *ngIf on user.picture to check if picture is empty? But I don't know how to get first letters of name. For example: if user.full_name contains Mary Johnson name and user.picture is empty then in place of picture, it should show MJ in place of picture. I can design the circle to show letters, just wanted to know how can I get first letters inside loop. Please help me

Related Questions