mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
5a886c0308
Update code examples to use < and > for html elements PR Close #48963
52 lines
1.1 KiB
Markdown
52 lines
1.1 KiB
Markdown
@name Suffix not supported
|
|
|
|
@description
|
|
|
|
This diagnostic detects when the `.px`, `.%`, and `.em` suffixes are used with an attribute
|
|
binding. These suffixes are only available for style bindings.
|
|
|
|
<code-example format="html" language="html">
|
|
|
|
<div [attr.width.px]="5"></div>
|
|
|
|
</code-example>
|
|
|
|
## What should I do instead?
|
|
|
|
Rather than using the `.px`, `.%`, or `.em` suffixes that are only supported in style bindings,
|
|
move this to the value assignment of the binding.
|
|
|
|
<code-example format="html" language="html">
|
|
|
|
<div [attr.width]="'5px'"></div>
|
|
|
|
</code-example>
|
|
|
|
## What if I can't avoid this?
|
|
|
|
This diagnostic can be disabled by editing the project's `tsconfig.json` file:
|
|
|
|
<code-example format="json" language="json">
|
|
|
|
{
|
|
"angularCompilerOptions": {
|
|
"extendedDiagnostics": {
|
|
"checks": {
|
|
"suffixNotSupported": "suppress"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
</code-example>
|
|
|
|
See [extended diagnostic configuration](extended-diagnostics#configuration) for more info.
|
|
|
|
<!-- links -->
|
|
|
|
<!-- external links -->
|
|
|
|
<!-- end links -->
|
|
|
|
@reviewed 2022-02-28
|