Edit in JSFiddle

@Component({
  selector: 'app-product-list',
  template: `...`
})
export class ProductListComponent implements OnInit {

  products: Product[];

  constructor(private productsRepository: ProductsRepositoryService) {}

  getProducts() {
    this.products = [];
    this.productsRepository
      .subscribe(products => this.products = products);
  }
  ngOnInit() {
    this.getProducts();
  }
}