Installation of Angular on Ubuntu
Angular is an Open source and TypeScript-based modern framework which is usually used to develop Front end Single Page Applications (SPAs) and PWAs. Angular is the updated version of AngularJS by the same team at Google.
This blog will cover the process steps of Angular installation on the Ubuntu platform. By the end of the blog, You will learn about –
In order to continue, You must have —
PS: While working with Angular, knowledge of TypeScript is good to have, but not mandatory
A brief note on Node.js
We are required to install Node.js because it acts as a lightweight server to run Angular applications. (If already installed, skip this part and jump to the next part of this blog.)
here setup_12.x is the version, and this command will add the node resource repo into Your Ubuntu OS. Now, let’s install Node.js using apt command, by running the below command —
Once installed completely, you can verify that the Node.js and npm versions are installed by using the following command in a terminal/console window. —
In the iniTIAl days of Angular, developers used to create whole architecture, webpack files, build process, etc for any project on their own from scratch, which is quite a time-consuming and lengthy process. To make it easier for the developer, the Angular team come up with an easy-to-use tool Angular CLI.
Angular CLI comes with a number of commands from creating a new project, to creating components, creating a routing configuration file, services, and many more.
where -g denotes that CLI is being installed globally to Your machine, which means You can create or run any command of CLI anywhere on Your machine. Once You run the above command CLI will be installed on Your machine, and You can verify the version installed using the following command:
where `x` represents the Version number. You can change it to any valid version number.
The first file to render on running this application will be index.html which is present in the src folder.
Run the application
You have completed the installation process of the Angular application via CLI, and now it’s time to run the application locally. As I said, Angular CLI comes with a complete tool-chain/commands for the developMent of front-end applications on Your machine.
Run the following command on the terminal (Navigate to the project directory if You are not in that directory)
Accessing Angular Web Interface
And it’s done!
Now You can make changes in the default component’s template which is app.component.html
It’s always recomMended to run the command npm cache clean after uninstallation of Angular CLI from Your system in order to avoid unwanted errors while installing it again. If You have any questions/doubts related to this blog, please let us know in the comMent box below, and we would be more than happy to Help You out. If You have read this far, feel free to share this blog on social media or tweet about it.
In this blog You have learned about what is Node/NPM and how You can install and use it. You have understood what is Angular CLI, and how You can use it after installing it on Your Ubuntu Platform. Then we have created a new angular project from scratch using CLI command, and learnt how to run it. Now You have basic hands-on Angular application knowledge which You can use to start developing more applications.