Skip to content

How to use with async pipe? #36

@kolkov

Description

@kolkov

Hi! How to use in this case?

<div *ngFor="let product of (products | async).items"

export class StoreFrontComponent implements OnInit {
  public products: Observable<ProductList>;

  constructor(private productsService: ProductsService,
              private shoppingCartService: ShoppingCartService) { }

  ngOnInit() {
    this.products = this.productsService.all()
  }

  public addProductToCart(product: Product): void {
    this.shoppingCartService.addItem(product, 1);
  }

  public removeProductFromCart(product: Product): void {
    this.shoppingCartService.addItem(product, -1);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions