Angular CLI Components
The component is the main block in the Angular CLI Application. Each Component consists of four files::
- HTML File (What you want to show on Your Page)
- CSS File (Style Applied to your content)
- TypeScript (Main Class of Component where you define the behavior)
- CSS Selector (Define how the component is used )
In this article, we will discuss how to create and configure the Angular CLI Component. Before this, you have done some prerequisite
- Install Angular CLI
- Create a New Project
- ng new <Project-name> // Type this to CMD to create a new project
Nice now you have Angular CLI and a brand new Angular Project. So now we will create a component in our project. There two ways to create a component.
- Creating Component using ANGULAR CLI
- Creating Component Manully
In this article, We will learn and create a component by using Angular CLI
- First, navigate to your project directory using Terminal
- Run the Command
ng generate component <component-name>
ng means Angular and <component-name> is the name of your component.
So congratulations you create a new component in your first project.
If you have any questions or error please let me know in the below comment session I will be happy to help you Thanks!
Angular CLI Components
Reviewed by Gaming Zone
on
January 16, 2021
Rating:
No comments:
If You have any Questions and Suggestions Please let me know. Thank you!