$any() type cast
This is the documentation for Angular 6.
You can switch to the latest version Angular 10.
You can switch to the latest version Angular 10.
Sometimes a binding expression will be reported as a type error and it is not possible or difficult to fully specify the type. To silence the error, you can use the $any
cast function to cast the expression to the any
type.
<!-- Accessing an undeclared member -->
<div>
The hero's marker is {{$any(hero).marker}}
</div>
The $any cast function can be used in conjunction with this to allow access to undeclared members of the component.
<!-- Accessing an undeclared member -->
<div>
Undeclared members is {{$any(this).member}}
</div>