This diagnostic detects uninvoked functions in text interpolation.
import {Component} from '@angular/core';
@Component({
template: `{{ getValue }}`,
})
class MyComponent {
getValue() {
return 'value';
}
}
What's wrong with that?
Functions in text interpolation should be invoked to return a value. If the function is not invoked, it will not return any value and the interpolation will not work as expected.
What should I do instead?
Ensure to invoke the function when you use it in text interpolation to return the value.
import {Component} from '@angular/core';
@Component({
template: `{{ getValue() }}`,
})
class MyComponent {
getValue() {
return 'value';
}
}
Configuration requirements
strictTemplates must be enabled for any extended diagnostic to emit.
uninvokedFunctionInTextInterpolation has no additional requirements beyond strictTemplates.
What if I can't avoid this?
This diagnostic can be disabled by editing the project's tsconfig.json file:
{
"angularCompilerOptions": {
"extendedDiagnostics": {
"checks": {
"uninvokedFunctionInTextInterpolation": "suppress"
}
}
}
}
See extended diagnostic configuration for more info.