⚠️ Mixin UI is currently in alpha stage
Documentation
Customization
Pipes

Map

Applies a pure transformation function to a value directly within the template, enabling functional-style composition without moving logic into the component class.

Import

import { XMapPipe } from '@mixin-ui/cdk';

Usage

@Component({
  template: `
    {{ value | map: multiply: 100 }}
  `
})
export class Usage {
  readonly value = 1;
  readonly multiply = (value: number, scale: number) => value * scale;
}

Examples

Loop rendering

@for (year of years(); track year.getTime()) {
  @let actual = year | map: isActual;
  @let selected = year | map: isSelected: value();
  @let disabled = year | map: isDisabled: min() : max();

  <button
    type="button"
    [class.actual]="actual"
    [class.selected]="selected"
    [class.disabled]="disabled"
  >
    {{ year }}
  </button>
}