Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Cart

Shopping cart which tracks products and maintains a subtotal

  • maintain a cart containing products and keeping track of quantities etc
  • you must provide a catalog of all available items
  • items with quantity 0 are considered "not in the cart"

Hierarchy

  • Cart

Index

Constructors

constructor

Properties

itemCatalog

itemCatalog: CartItem[] = []

panelOpen

panelOpen: boolean = false

Accessors

activeItems

  • Getter for items which are "in the cart"

    • active items are cart items with quantity greater than zero

    Returns CartItem[]

price

  • get price(): string
  • Formatter price tag for the whole cart's value

    Returns string

value

  • get value(): number

Methods

clear

  • clear(): void

getProductItem

togglePanelOpen

  • togglePanelOpen(open?: boolean): boolean
  • Toggle the cart panel open or closed

    Parameters

    • Default value open: boolean = null

    Returns boolean

Generated using TypeDoc