SlideShare a Scribd company logo
1 of 25
Angular
( formerly Angular 4 )
One framework.
Mobile & desktop.
Tejinder Singh
Software Engineer
Softprodigy System Solutions
tejindermakkar786@gmail.com
(8284045404)
 Introduction of Angular.
 Features of Angular.
 Development environment setup.
 Project setup
 Structure of Angular project.
 How to install packages.
 What is TypeScript .
 How Angular application start.
 Components.
 How to create component.
 Styling component.
 Component selector.
 Databinding
Agenda
• Angular is an open source JavaScript framework that is used to
build single page based web applications.
• Developed by Google
• Release Date - March 2017
• One framework. Mobile & Desktop.
Angular
Cross
Platform
Productivity
Speed and
Performance
Features of Angular
Development
Cross Platform
 Angular use modern web platform capabilities to deliver app-like experiences.
 High performance and zero-step installation.
 Build native mobile apps with Ionic Framework, NativeScript, and React Native.
 Create desktop - installed apps across Mac, Windows, and Linux.
Speed and Performance
Angular turns our templates into code that's highly optimized for today's JavaScript
machines.
Serve the first view of your application on node.js, .NET, PHP, and other servers for
rendering in just HTML and CSS. .
 Angular apps load quickly with the new Component Router.
Productivity
 Quickly create UI views with simple and powerful template syntax.
 Command line tools:
 Start building fast
 Add components and tests
 Then instantly deploy.
 Get intelligent code completion, instant errors in popular editors and IDEs.
Full Development Story
Karma for unit tests.
 Protractor makes our scenario tests run faster and in a stable manner.
Create high-performance, complex choreographies and animation timelines
with very little code through Angular's intuitive API.
Development Environment Setup
https://nodejs.org/en/download/
Node.js
• Node.js is an open-source, cross-platform JavaScript run-time environment for
executing JavaScript code server-side.
• Download latest version i.e. node v6.10.3
Syntax : - node -v
Check node.js version
• This command is used for checking
current installed version of node.
Syntax : - npm -vCheck npm version
• This command is used for checking
current installed version of Node Package
Manager (npm).
Text Editor
• Visual Studio Code, WebStrome , Sublime or any other text editor IDE
Project Setup
Angular CLI is command line interface for Angular
 Open node js command prompt in admin mode.
Syntax : - npm install –g <packagename>
F:/Angular4> npm install –g @angular/cli Node.js command prompt
Current working directory
Globally
Package Name
Creating project using Angular CLI
Syntax : - ng new <project_name>
F:/Angular4> ng new MyFirstDemoApp Node.js command prompt
Current working directory
Project Name
Enter into newly created project folder i.e. MyFirstDemoApp
Step 4 Run application
Syntax : - ng serve
F:/Angular4/MyFirstDemoApp> ng serve
 ng serve command is used for to run application.
Open web browser - localhost:4200
Structure of project
NPM is the node package manager, which installs packages
locally into a project, specifically, into the node_modules
folder.
All images, stylesheets, JavaScript or third party libraries reside in
assets
Configuration Files
Root project folder, all components reside is app
folder.
Entry point of application
Installing Packages
npm install command is used for installing packages.
Syntax
npm install <package_name>
Example
F:/Angular4/MyFirstDemoApp> npm install bootsrap
How App Start
main.ts • Main.ts file is entry point of our application.
• Main.ts file bootstrap app.module.ts file
app.module.ts
• This file bootstrap our first component i.e
app.component.ts
app.component.ts • This file render app.component.html file.
app.component.html • Final HTML template
TypeScript
 TypeScript is a free and open source programming language.
 It is developed and maintained by Microsoft.
 It is syntactical superset of JavaScript and adds optional static typings and class
based object oriented programming to the language.
Components
 Components are a logical piece of code for Angular application.
A Component consists of the following −
 Template is used to render
the view for the application.
 This contains the HTML that
needs to be rendered in the
application.
 This is like a class defined in any
language such as C#.
 This has the code which is used
to support the view.
 It is defined in TypeScript.
 This has the extra data
defined for the Angular class.
 It is defined with a decorator.
Decorator
Defines the name of the HTML tag.
It holds our HTML template.
The styles option is used to
style a specific component
 Defining a class called
AppComponent.
 The export keyword is used so that
the component can be used in other
modules in the application.
 title is the name of the property.
 The property is given a value of
‘app’.
We are using the import keyword to
import the ‘Component’ decorator
from the angular/core module.
Creating Component
 ng generate command is used for create component.
Syntax
ng generate component <component_name>
or
ng g c <component_name>
Example
F:/Angular4/MyFirstDemoApp>
ng g c server
Data binding
 Data binding is communication between business logic and views.
Typescript
Code
(Business
Logic) Template
(HTML)
Data binding = Communication
Output Data
String Interpolation => {{ data }}
Property Binding => [property] = “ data “
String Interpolation Interpolation markup is used to provide data-binding to text and attribute values.
Syntax
export class <class_name>
{
variableName = ‘any string';
}
Example
export class AppComponent
{
title = ‘This is my demo app';
}
<div {{variableName }} > <div {{ title }} > </div>
Property Binding
HTML
<button [disabled]="!isActive"
class="btn">ADD</button>
Typescript
export class ClientComponent {
isActive = false;
constructor() {
setTimeout(() =>
{ this.isActive = true; }, 2000); }
ngOnInit() { }
Property binding allow us to bind values to properties of an element to modify their
behavior or appearance. This can include properties such as class, disabled, href or
textContent.
Angular4 getting started

More Related Content

What's hot

What's hot (20)

Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
 
Angular 4 - quick view
Angular 4 - quick viewAngular 4 - quick view
Angular 4 - quick view
 
What’s new in angular 12[highlights of angular 12 features]
What’s new in angular 12[highlights of angular 12 features]What’s new in angular 12[highlights of angular 12 features]
What’s new in angular 12[highlights of angular 12 features]
 
Angular EE - Special Workshop by Nir Kaufman
Angular EE - Special Workshop by Nir KaufmanAngular EE - Special Workshop by Nir Kaufman
Angular EE - Special Workshop by Nir Kaufman
 
Talk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG BéninTalk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG Bénin
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
 
Meetup SkillValue - Angular 6 : Bien démarrer son application
Meetup SkillValue - Angular 6 : Bien démarrer son applicationMeetup SkillValue - Angular 6 : Bien démarrer son application
Meetup SkillValue - Angular 6 : Bien démarrer son application
 
What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...
What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...
What's New in Angular 4 | Angular 4 Features | Angular 4 Changes | Angular Tu...
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
Angular 4 Introduction Tutorial
Angular 4 Introduction TutorialAngular 4 Introduction Tutorial
Angular 4 Introduction Tutorial
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaAngular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
 
Mastering angular - Dot Net Tricks
Mastering angular - Dot Net TricksMastering angular - Dot Net Tricks
Mastering angular - Dot Net Tricks
 
Say hello world with angular 5
Say hello world with angular 5Say hello world with angular 5
Say hello world with angular 5
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 
Angular 2 - SSD 2016 London
Angular 2 - SSD 2016 LondonAngular 2 - SSD 2016 London
Angular 2 - SSD 2016 London
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready
 
Ng talk
Ng talkNg talk
Ng talk
 
Angular App Presentation
Angular App PresentationAngular App Presentation
Angular App Presentation
 

Similar to Angular4 getting started

4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
 

Similar to Angular4 getting started (20)

Integrating TypeScript with popular frameworks like React or Angular.pdf
Integrating TypeScript with popular frameworks like React or Angular.pdfIntegrating TypeScript with popular frameworks like React or Angular.pdf
Integrating TypeScript with popular frameworks like React or Angular.pdf
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
Angular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfAngular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdf
 
Angular IO
Angular IOAngular IO
Angular IO
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
 
How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
Introduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setupIntroduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setup
 
Angular
AngularAngular
Angular
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERE
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
 
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 

Recently uploaded

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Recently uploaded (20)

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 

Angular4 getting started

  • 1. Angular ( formerly Angular 4 ) One framework. Mobile & desktop. Tejinder Singh Software Engineer Softprodigy System Solutions tejindermakkar786@gmail.com (8284045404)
  • 2.  Introduction of Angular.  Features of Angular.  Development environment setup.  Project setup  Structure of Angular project.  How to install packages.  What is TypeScript .  How Angular application start.  Components.  How to create component.  Styling component.  Component selector.  Databinding Agenda
  • 3. • Angular is an open source JavaScript framework that is used to build single page based web applications. • Developed by Google • Release Date - March 2017 • One framework. Mobile & Desktop. Angular
  • 5. Cross Platform  Angular use modern web platform capabilities to deliver app-like experiences.  High performance and zero-step installation.  Build native mobile apps with Ionic Framework, NativeScript, and React Native.  Create desktop - installed apps across Mac, Windows, and Linux.
  • 6. Speed and Performance Angular turns our templates into code that's highly optimized for today's JavaScript machines. Serve the first view of your application on node.js, .NET, PHP, and other servers for rendering in just HTML and CSS. .  Angular apps load quickly with the new Component Router.
  • 7. Productivity  Quickly create UI views with simple and powerful template syntax.  Command line tools:  Start building fast  Add components and tests  Then instantly deploy.  Get intelligent code completion, instant errors in popular editors and IDEs.
  • 8. Full Development Story Karma for unit tests.  Protractor makes our scenario tests run faster and in a stable manner. Create high-performance, complex choreographies and animation timelines with very little code through Angular's intuitive API.
  • 9. Development Environment Setup https://nodejs.org/en/download/ Node.js • Node.js is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side. • Download latest version i.e. node v6.10.3 Syntax : - node -v Check node.js version • This command is used for checking current installed version of node.
  • 10. Syntax : - npm -vCheck npm version • This command is used for checking current installed version of Node Package Manager (npm). Text Editor • Visual Studio Code, WebStrome , Sublime or any other text editor IDE
  • 11. Project Setup Angular CLI is command line interface for Angular  Open node js command prompt in admin mode. Syntax : - npm install –g <packagename> F:/Angular4> npm install –g @angular/cli Node.js command prompt Current working directory Globally Package Name
  • 12. Creating project using Angular CLI Syntax : - ng new <project_name> F:/Angular4> ng new MyFirstDemoApp Node.js command prompt Current working directory Project Name
  • 13. Enter into newly created project folder i.e. MyFirstDemoApp Step 4 Run application Syntax : - ng serve F:/Angular4/MyFirstDemoApp> ng serve  ng serve command is used for to run application.
  • 14. Open web browser - localhost:4200
  • 15. Structure of project NPM is the node package manager, which installs packages locally into a project, specifically, into the node_modules folder. All images, stylesheets, JavaScript or third party libraries reside in assets Configuration Files Root project folder, all components reside is app folder. Entry point of application
  • 16. Installing Packages npm install command is used for installing packages. Syntax npm install <package_name> Example F:/Angular4/MyFirstDemoApp> npm install bootsrap
  • 17. How App Start main.ts • Main.ts file is entry point of our application. • Main.ts file bootstrap app.module.ts file app.module.ts • This file bootstrap our first component i.e app.component.ts app.component.ts • This file render app.component.html file. app.component.html • Final HTML template
  • 18. TypeScript  TypeScript is a free and open source programming language.  It is developed and maintained by Microsoft.  It is syntactical superset of JavaScript and adds optional static typings and class based object oriented programming to the language.
  • 19. Components  Components are a logical piece of code for Angular application. A Component consists of the following −  Template is used to render the view for the application.  This contains the HTML that needs to be rendered in the application.  This is like a class defined in any language such as C#.  This has the code which is used to support the view.  It is defined in TypeScript.  This has the extra data defined for the Angular class.  It is defined with a decorator.
  • 20. Decorator Defines the name of the HTML tag. It holds our HTML template. The styles option is used to style a specific component  Defining a class called AppComponent.  The export keyword is used so that the component can be used in other modules in the application.  title is the name of the property.  The property is given a value of ‘app’. We are using the import keyword to import the ‘Component’ decorator from the angular/core module.
  • 21. Creating Component  ng generate command is used for create component. Syntax ng generate component <component_name> or ng g c <component_name> Example F:/Angular4/MyFirstDemoApp> ng g c server
  • 22. Data binding  Data binding is communication between business logic and views. Typescript Code (Business Logic) Template (HTML) Data binding = Communication Output Data String Interpolation => {{ data }} Property Binding => [property] = “ data “
  • 23. String Interpolation Interpolation markup is used to provide data-binding to text and attribute values. Syntax export class <class_name> { variableName = ‘any string'; } Example export class AppComponent { title = ‘This is my demo app'; } <div {{variableName }} > <div {{ title }} > </div>
  • 24. Property Binding HTML <button [disabled]="!isActive" class="btn">ADD</button> Typescript export class ClientComponent { isActive = false; constructor() { setTimeout(() => { this.isActive = true; }, 2000); } ngOnInit() { } Property binding allow us to bind values to properties of an element to modify their behavior or appearance. This can include properties such as class, disabled, href or textContent.