What Is Angular How To Install It

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

What is angular how to install it?

Angular is a popular open-source Typescript framework created by Google for


developing web applications. Front-end developers use frameworks like Angular or
React to present and manipulate data efficiently and dynamically. Updated Angular
every time becomes much more efficient compared to the older version of Angular

Features of Angular
It uses components and directives.
It is written in Microsoft’s TypeScript language, which is a superset of ECMAScript 6
(ES6).
Angular is supported by all the popular mobile browsers.
Properties enclosed in “()” and “[]” are used to bind data between the view and the
model.
It provides support for TypeScript and JavaScript.
Angular uses @Route Config{(…)} for routing configuration.
It comes with the Angular CLI tool.

Applications of Angular
Single-Page Applications (SPAs): Angular is particularly well-suited for building SPAs,
where a single webpage is created and content is dynamically updated as the user
interacts.
Real-Time Applications: Angular is most used in real-time applications, such as chat
applications, weather and forecasting, and live tracking systems, where immediate
updates are essential.
Enterprise Applications: Angular is commonly used for developing large-scale
enterprise applications. Its modular architecture, dependency injection, and
TypeScript support make it suitable for building complex and maintainable
applications.
Content Management Systems (CMS): Angular can be used to build custom content
management systems, providing a dynamic and responsive user interface for
managing content.
E-commerce Websites: Angular’s two-way data binding and dynamic features make it
suitable for building interactive e-commerce websites with real-time updates and
user interactions.
Dashboards and Analytics Tools: Angular is used to create interactive dashboards and
analytics tools, it helps in data visualization and crucial real-time updates.
Cross-Platform Mobile Apps: With frameworks like Ionic or NativeScript, Angular is
used to build cross-platform mobile applications for iOS and Android operating
systems.
Social Media Applications: Angular is used widely for building social media
applications with dynamic content rendering, and interactive features.

Here are the steps on how to install Angular:

Install Node.js: Angular requires Node.js to be installed on your computer. You can
download and install Node.js from the official Node.js website:
https://node.js.org/en/download/

Install Angular CLI: Once you have installed Node.js, you can install the Angular CLI
using the following command:

npm install -g @angular/cli


The Angular CLI is a command-line tool that provides a variety of features for
developing Angular applications, such as creating new projects, generating code, and
running applications.

Create a new Angular project: To create a new Angular project, use the following
command:
ng new my-app
This will create a new directory called my-app and generate the basic files for an
Angular project.
Start the development server: To start the development server and run your Angular
application, use the following command:
ng serve
This will start a web server on port 4200 and open your default browser to
http://localhost:4200, where you can see your running Angular application.

That's it! You have now installed Angular and created your first Angular application.

Q2) What is component and how to create a component?

The component is the basic building block of Angular. It has a selector, template,
style, and other properties, and it specifies the metadata required to process the
component.
Creating a Component in Angular 8:
To create a component in any angular application, follow the below steps:
Get to the angular app via your terminal.
Create a component using the following command:
ng g c <component_name>
OR
ng generate component <component_name>
Ex- ng g c Geeks For Geeks
Using a component in Angular 8:
 Go to the component.html file and write the necessary HTML code.
 Go to the component.css file and write the necessary CSS code.
 Write the corresponding code in component.ts file.
 Run the Angular app using ng serve –open

Implementation code: Please note that the name of the component in the below
code is gfg component.
gfg.component.html:
<h1>GeeksforGeeks</h1>

gfg.component.css:
h1{
color: green;
font-size: 30px;
}

gfg.component.ts:
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-gfg',
templateUrl: './gfg.component.html',
styleUrls: ['./gfg.component.css']
})
export class GfgComponent{
a ="GeeksforGeeks";
}

app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';


import { GfgComponent } from './gfg/gfg.component';

@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent, GfgComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }

OUTPUT: -
Localhost: 4200
GeeksforGeeks

You might also like