You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of components make use of accessors. There are several reasons to not do that:
using accessors in ht .html is inefficient; when using a field directly, Angular can register observers, making this event-driven. When using methods, Angular needs to poll the method
if a computation is complex and can benefit from a method, make it functional and pass in required parameters; that way Angular can see when parameters change and the methods needs to be called instead of polling
Typescript has native getters/setters. Use these instead of Java-style accessor methods.
Angular's new (still in preview) signals are almost always better than methods
The text was updated successfully, but these errors were encountered:
Angular is not Java.
A lot of components make use of accessors. There are several reasons to not do that:
using accessors in ht .html is inefficient; when using a field directly, Angular can register observers, making this event-driven. When using methods, Angular needs to poll the method
if a computation is complex and can benefit from a method, make it functional and pass in required parameters; that way Angular can see when parameters change and the methods needs to be called instead of polling
Typescript has native getters/setters. Use these instead of Java-style accessor methods.
Angular's new (still in preview) signals are almost always better than methods
The text was updated successfully, but these errors were encountered: