Ensures that property-binding is used instead of interpolation in attributes.
- Type: suggestion
The rule does not have any configuration options.
The following examples are generated automatically from the actual unit tests within the plugin, so you can be assured that their behavior is accurate based on the current commit.
❌ - Toggle examples of incorrect code for this rule
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<input type="text" name="{{ foo }}">
~~~~~~~~~
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<input type="text" name="{{ foo }}bar">
~~~~~~~~~~~~
✅ - Toggle examples of correct code for this rule
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<input type="text" [name]="foo">
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<input type="text" name="foo" [(ngModel)]="foo">
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<input type="text" [name]="foo + 'bar'">
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<input type="text" [name]="foo | bar">
{
"rules": {
"@angular-eslint/template/no-interpolation-in-attributes": [
"error"
]
}
}
<div>{{ content }}</div>