Make profile picture placeholder by first two character of name

Make profile picture placeholder by first two character of name. I have been working on a project where i needed to make some profile picture to work as based on the first two character of the names at the time when users have not updated his picture. This you have been seen working in the …

Add to compare service for observable array of objects for products

Add to compare service for observable array of objects for products. import { Injectable } from ‘@angular/core’; import { BehaviorSubject } from ‘rxjs/BehaviorSubject’; @Injectable() export class SharedService { compareProducts:Array<Product> = []; private compareSource = new BehaviorSubject<Product[]>([]); currentCompare = this.compareSource.asObservable(); constructor() { } addToCompare(productModel){ var index = this.compareProducts.findIndex(item => item.id === productModel.id); if(index > -1){ this.compareProducts.splice(index,1); …