File

projects/apttus/elements/src/lib/price/price.component.ts

Description

Wrapper component for displaying the price of a record. Supports cart, product, cart item, product options and orders. Change detection on this component has been tuned, so use this component in favor of using the price pipes directly.

Usage

import { PriceModule } from '@apttus/elements';

@NgModule({
  imports: [PriceModule, ...]
})
export class AppModule {}

Implements

OnChanges OnDestroy

Example

// Basic Usage
<apt-price [record]="product"></apt-price>

// All inputs and outputs.
<apt-price
[record]="product"
[quantity]="1"
[attributeValue]="attributeValue"
[formatted]="false"
[type]="total"
[term]="term"
[bundle]="true"
></apt-price>

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector apt-price
styles :host{ display: block; }
template
<ng-container *ngIf="price$ | async as price; else empty">
  {{price}}
</ng-container>
<ng-template #empty>-</ng-template>

Index

Inputs

Constructor

constructor(priceService: PriceService, localCurrencyPipe: LocalCurrencyPipe)
Parameters :
Name Type Optional
priceService PriceService No
localCurrencyPipe LocalCurrencyPipe No

Inputs

attributeValue
Type : ProductAttributeValue

Instance of ProductAttributeValue used to calculate the price of bundle product record.

bundle
Type : boolean
Default value : false

Flag to set this product type as a bundle

formatted
Type : boolean
Default value : true

Optional boolean argument to display the price as a formatted currency or as a raw number (defaults to true)

options
Type : Array<AssetLineItem | QuoteLineItem | OrderLineItem>
quantity
Type : number
Default value : 1

The quantity of the record (defaults to 1)

record
Type : Cart | Product | CartItem | ProductOptionComponent | Order | OrderLineItem | Quote | QuoteLineItem | AssetLineItem | Array<CartItem | AssetLineItem | QuoteLineItem | CartItem>

The input record to display the price for. Can be of type Cart, Product, CartItem, ProductOptionComponent or Order

term
Type : number

Term used to calculate price of bundle product.

type
Type : "net" | "base" | "discount" | "baseExtended" | "list" | "listExtended"
Default value : 'net'

The type of the output; net price, base price, discounted price or unit price (defaults to net)


    :host{
      display: block;
    }
  
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""