DEV Community

Gabriela Diniz
Gabriela Diniz

Posted on

The basic commands in Angular

Basic commands to initialize your project in Angular:

  • To create a new project, open your terminal and execute:
ng new project-name
Enter fullscreen mode Exit fullscreen mode
  • To execute your application and create the server project, execute the following commands:
ng serve
Enter fullscreen mode Exit fullscreen mode
  • Create a component:
ng g c /folder-name/component-name
Enter fullscreen mode Exit fullscreen mode
  • Create a module:
ng g m /folder-name/component-name
Enter fullscreen mode Exit fullscreen mode
  • Create an interface:
ng g interface /folder-name/interface-name
Enter fullscreen mode Exit fullscreen mode
  • Create a service:
ng g s /folder-service/service-name
Enter fullscreen mode Exit fullscreen mode
  • Install CLI:
npm i -g @angular/cli
Enter fullscreen mode Exit fullscreen mode

If you want to deploy your Angular project locally or on GitPages, for example, execute:

ng build
Enter fullscreen mode Exit fullscreen mode

This command allows you to generate a "bundle" of the entire project, in the format of HTML + Javascript + CSS files, to be published on any static server.


Observations:

  • Services are not automatically imported into app.module.ts (unlike components).
  • :host {} in the SCSS file modifies only that specific file.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay