File tree Expand file tree Collapse file tree
packages/angular/src/common/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 * Strings are coerced the same way Angular's `booleanAttribute` coerces them, so `''` (a bare
1313 * attribute) becomes `true` and `'false'` becomes `false`.
1414 *
15- * Unlike Angular's `booleanAttribute`, `null` and `undefined` are passed through rather than
16- * coerced to `false`. Components frequently treat them as a state distinct from `false`, and both
17- * reach inputs routinely from the `async` pipe before its first emission and from form control
18- * values:
15+ * Angular's own `booleanAttribute` is not used because it coerces `null` and `undefined` to
16+ * `false`. Components frequently treat those as a state distinct from `false`, such as
17+ * `ion-item`'s `detail` resolving `undefined` to a computed default, and both reach inputs
18+ * routinely from the `async` pipe before its first emission and from form control values.
1919 *
20- * ```tsx
21- * // `undefined` means "decide based on the mode", which is not the same as `false`
22- * const showDetail = detail !== undefined ? detail : mode === 'ios';
23- *
24- * // a strict comparison also behaves differently for `null` than it does for `false`
25- * const showHandle = handle !== false;
26- * ```
20+ * The parameter type is what Angular derives `ngAcceptInputType_*` from, so it decides which
21+ * template bindings compile. Widening it to `unknown` would let any expression through.
2722 *
2823 * Declared as a function rather than an arrow constant because Angular has to resolve input
2924 * transforms statically when compiling a library in partial compilation mode.
You can’t perform that action at this time.
0 commit comments