Import
In most cases, the components you are going to create will refer to some external function, or a class. This class can be another component, a model that defines the custom data type, or even a third-party library. To be able to access these functions, we need to import them in our component. Angular allows such imports by using the import keyword.
The import keyword is similar to the using statement we have in C# language. This helps us to access the external methods and properties. One import statement that you will have in your component class would be from Angular. We import the component keyword from the Angular core module, which is used as a decorator in our class. The following is the syntax of the import keyword:
importBecome 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