0 votes
in Angular by

What is the purpose of any type cast function?

1 Answer

0 votes
by

You can disable binding expression type checking using $any() type cast function(by surrounding the expression). In the following example, the error Property contacts does not exist is suppressed by casting user to the any type.

  template:

  '{{ $any(user).contacts.email }}'

The $any() cast function also works with this to allow access to undeclared members of the component.

   template:

   '{{ $any(this).contacts.email }}'

...