# wrNumAttr

> Input transform that coerces a bound value to a number, with a fallback.

Source: https://ngwr.dev/reference/utils/wr-num-attr  
Kind: Util  
Updated in v16  
Optional

## Usage

```angular-ts
import { wrNumAttr } from 'ngwr/utils';

readonly speed = input(4, { transform: wrNumAttr(4) });

// speed="12"     gives 12
// speed="abc"    gives 4
// [speed]="null" gives 4
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `wrNumAttr` | Returns an input transform: a number, or `fallback` for `null`, `undefined` and unparsable input. | `(fallback: number) => (value: unknown) => number` | `—` |

## See also

- [wrResolveCssSize](https://ngwr.dev/reference/utils/wr-resolve-css-size) — Turns a size into a CSS value and, when it can, a pixel number.
- [wrClamp](https://ngwr.dev/reference/utils/wr-clamp) — Clamps a number into an inclusive [min, max] range.
