Component class
The component class is where the brain of the component resides. This class is written in TypeScript, and has properties and methods. The properties define the data members of the component, and are bound to the template using Angular binding syntax. The methods provide interface for the events that are triggered on the user interface.
As we have learned, each class is defined by the class keyword followed by the class name. One of the best practices defined for the component class is to name the class followed by the component keyword, such as newsComponent. The export keyword in front of the class allows the class to be available to the other components of the application. The following is an example of one such class: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access