UNPKG

ng-shopping-cart

Version:

An Angular component library to create shopping carts

93 lines (92 loc) 2.35 kB
import { CartItem } from './cart-item'; /** * A default implementation for CartItem * * @order 2 * * @howToUse "Using properties and methods" * ```typescript * const item = new BaseCartItem({id: 1, name: 'Demo'}); * item.quantity = 10; * item.setQuantity(50); * console.log(item.quantity) // prints 50 * ``` * * @note {info} You can access item information either with direct property access or method calls, eg. `item.id === item.getId()` */ export declare class BaseCartItem extends CartItem { /** * The id of the item */ id: any; /** * The name of the item */ name: string; /** * The price of the item */ price: number; /** * The url of an image for the item */ image: string; /** * The ordered quantity of the item */ quantity: number; /** * Any additional data you want to include in the item */ data: any; constructor(itemData?: any); /** * Abstract base method implementation to obtain the item id */ getId(): any; /** * Sets the current id for the item * @param id {any}: The id value */ setId(id: any): void; /** * Abstract base method implementation to return the name, a small text describing the item */ getName(): string; /** * Sets the name of the item */ setName(name: string): void; /** * Abstract base method implementation to know how much the item cost */ getPrice(): number; /** * Set the price of the item */ setPrice(price: number): void; /** * Abstract base method implementation to return how much of the item is ordered */ getQuantity(): number; /** * Abstract base method implementation to set how much of the item is ordered */ setQuantity(quantity: number): void; /** * Abstract base method implementation to get the url of an image for the item */ getImage(): string; /** * Sets the url of the item's image */ setImage(image: string): void; /** * Gets any additional data added to the item */ getData(): any; /** * Sets any additional data to the item */ setData(data: any): void; }