The internship company requires the use of Angular. I have learned VUE and have some understanding of React, but Angular is something I haven’t used before. Time to start from scratch.

Installing node

Check the version. Previously, I always used the cmd window. Today, I learned about the powershell window, which feels quite similar. Use shift+win+right-click to open it.

1$ node -v
2$ npm -v

Installing Angular

Scaffolding

1$ npm install -g @angular/[email protected]

Checking the Version

1$ ng v # ng version
  • Encountered an error as shown below:
  • Solution:
  1. Run Windows PowerShell as Administrator.

  2. Enter the following command and type A to change the permissions.

    1$ set-ExecutionPolicy RemoteSigned
    
  3. Enter the following command to check the current status.

    1$ get-ExecutionPolicy
    
  • Check the version again; the installation is successful.

Uninstalling Angular

1$ npm uninstall -g @angular/cli

Creating a Project

  1. cd to the directory where you want to store the project and enter the command.

    1$ ng new <project-name>
    2$ yes
    3$ css
    

    The installation of dependencies takes a while. You can skip the dependency installation step initially and install them after the project is created.

    1$ ng new <project-name> --skip-install
    
  2. The project structure after creation is as follows:

  3. cd to the project directory and enter the command:

    1$ ng serve --open # ng serve --o or ng serve
    

The explanation given by stackoverflow is: To Fix Error “This command is not available when running the Angular CLI outside a workspace Error”, Do Right-Click on your project name in VS Code and Click “Open in Integrated Terminal” Option.

Run it in VScode, and it will open the default browser, displaying the Angular welcome page.