SlideShare a Scribd company logo
Fly High with
Angular
By Rajdeep Mandrekar & Wolfgang Furtado

GETTINGSTARTEDWITHANGULAR
Prerequisites
➔ Setting up the machine
◆ Install nvm (https://github.com/creationix/nvm#installation)
◆ Install node (nvm install v8.9.2)
◆ Install yarn (npm install -g yarn)
◆ Install angular-cli (npm install -g @angular/cli)
➔ Basic knowledge of HTML, CSS and JS

Fly High With Angular - How to build an app using Angular
WhatisAngular?
➔ Angular is a TypeScript-based open-source front-end web
application platform for dynamic web applications
➔ Created by the Angular Team at Google
➔ Provides a way to organize your HTML, JavaScript, and CSS
to keep your front-end code clean.
WhyAngular?
➔ Magical Two-Way data binding
➔ Routing Support
➔ Structured front end code
➔ Teach HTML new syntax with directives
➔ Huge community support
AngularArchitecture

TypeScript
➔ Typescript is a typed superset of Javascript that compiles to
plain Javascript
➔ It differentiates itself from competitors like CoffeeScript
and Dart in that plain JavaScript code can be intermixed
with TypeScript. Therefore JavaScript is TypeScript.
➔ JavaScript is TypeScript, but TypeScript is not JavaScript.
TypeScript
➔ Optional static typing (the key here is optional)
➔ Type Inference, which gives some of the benefits of types,
without actually using them
➔ Access to ES6 and ES7 features, before they become
supported by major browsers
➔ The ability to compile down to a version of JavaScript that
runs on all browsers
➔ Great tooling support with IntelliSense
GeneratingAngularproject
➔ Use Angular CLI
➔ Why angular cli?
◆ Generates a clean project structure
◆ Auto compile code on save
◆ In-built server & compiler (error detection is fast)
◆ Manages all the npm dependencies
GeneratingAngularproject
> npm install -g @angular/cli
> ng new fly-with-angular
> cd fly-with-angular
> ng serve
LET’SGOTHROUGHTHEPROJECTFOLDER
STRUCTURE
HOWDOESANANGULARAPPBOOTSTRAP?
COMPONENTS

Whatisacomponent?
➔ Components are the building blocks of Angular
applications.
➔ A component controls a patch of screen called a view.
➔ They easily nest one inside the other
➔ Each component may have its own: Class file, HTML file,
CSS file
Componenttree
Creatingacomponent
> ng generate component trips-list
Whatyou’llbebuilding
Fly High With Angular - How to build an app using Angular
Databinding
Is automatic synchronization of data between the model and
view components.
➔ One-way from data source to view target
{{expression}}
[target]="expression"
➔ One-way from view target to data source
➔ Two-way
(event)="statement"
[(target)]="expression"
➔ Property
<img [src]="heroImageUrl">
<my-app [book]="currentBook"></my-app>
<div [ngClass]="{'special': isSpecial}"></div>
➔ Event
➔ Attribute
<button (click)="onSave()">Save</button>
<img [attr.alt]="help" src="./..">
➔ Class
➔ Style
➔ Two-way (Banana in a box)
<div [class.special]="isSpecial">Special</div>
<button [style.color]="isSpecial ? 'red' : 'green'">
<input [(ngModel)]="name">
Fly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using Angular
Interface
In simple words interfaces is a way of describing the shape of
the JavaScript object.
It helps us keep our programs error-free by providing
information about the shape of the data we work with.
Class:
While class deals with the implementation.
Fly High With Angular - How to build an app using Angular
export interface Person {
firstName: string;
lastName: string;
age: number;
}
Fly High With Angular - How to build an app using Angular
Directives
Directives is how we add dynamic behavior to HTML . There
are 3 kinds of directive
➔ Components
◆ directives with a template
➔ Structural directives
◆ change the DOM layout by adding and removing DOM elements.
➔ Attribute directives
◆ change the appearance or behavior of an element, component, or another
directive.
Some most common used directives:
➔ ngIf => *ngIf="persons.length == 0"
➔ ngFor => *ngFor="let person of persons"
➔ ngSwitch/ngSwitchCase
➔ ngValue
➔ ngModel
Fly High With Angular - How to build an app using Angular
Pipes
➔ A pipe takes in data as input and transforms it to a desired
output.
➔ Ex: DatePipe, UpperCasePipe, LowerCasePipe,
CurrencyPipe, etc.
{{‘abc’ | uppercase}}
abc ABC
Fly High With Angular - How to build an app using Angular
EventBinding
➔ With event binding you can respond to any DOM event.
➔ To bind to a event binding, surround the DOM event name
in parentheses and assign a quoted template statement to
it.
Eg. <button (click)="doAwesomeThing()">Click me!</button>
Forms
There are two ways to build forms:
➔ Reactive Forms
➔ Template-driven forms
The two technologies belong to the @angular/forms library
and share a common set of form control classes.
ReactiveForms
➔ Angular reactive forms favors explicit management of the
data flow between UI elements and server data.
➔ With reactive forms, you create a tree of Angular form
control objects in the component class.
➔ Bind form controls to native form control elements in the
component template.
Template-drivenforms
➔ You place HTML form controls (such as <input> and
<select>) in the component template and bind them to
data model properties in the component, using directives
like ngModel.
➔ You don't create Angular form control objects
➔ You don't push and pull data values. Angular handles that
for you with ngModel
➔ Angular updates the mutable data model with user
changes as they happen.
Template-drivenvsReactiveForms
➔ Reactive forms does not mutate the data model whereas
template-driven forms does.
➔ Reactive forms are synchronous. Template-driven forms
are asynchronous.
➔ In template-driven forms you can't pass the validator in
like you can for reactive forms. Instead, you need to add a
directive to the template.
ReactiveForms
Import ReactiveFormsModule
Add to imports list
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name”
[(ngModel)]="model.name" name="name">
</div>
FormValidations
Why validate forms?
➔ For accuracy and completeness.
➔ Form validation is required to prevent web form abuse by
malicious users.
➔ Improper validation of form data is one of the main causes
of security vulnerabilities.
➔ It exposes your website to attacks such as header
injections, cross-site scripting, and SQL injections etc
ValidateReactiveForms
➔ In a reactive form, the source of truth is the component
class.
➔ Add validator functions directly to the form control model
in the component class
➔ Angular then calls these functions whenever the value of
the control changes.
Built-inValidators
➔ min
➔ max
➔ required
➔ email
➔ minLength
➔ maxLength
➔ Pattern
You can also create your custom validators and pass it to the
form.
Fly High With Angular - How to build an app using Angular
THANKYOU
Fly High With Angular - How to build an app using Angular
https://tinyurl.com/vlangular

More Related Content

What's hot (20)

Angular js tutorial slides
Angular js tutorial slides
samhelman
 
AngularJS Best Practices
AngularJS Best Practices
Narek Mamikonyan
 
Angularjs architecture
Angularjs architecture
Michael He
 
AngularJS intro
AngularJS intro
dizabl
 
Angular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
Understanding angular js
Understanding angular js
Aayush Shrestha
 
Introduction of angular js
Introduction of angular js
Tamer Solieman
 
AngularJS Basics
AngularJS Basics
Ravi Mone
 
Getting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
AngularJS best-practices
AngularJS best-practices
Henry Tao
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Angular JS Indtrodution
Angular JS Indtrodution
adesh21
 
Step by Step - AngularJS
Step by Step - AngularJS
Infragistics
 
Introduction to AngularJS
Introduction to AngularJS
Jussi Pohjolainen
 
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Apaichon Punopas
 
Web Components Everywhere
Web Components Everywhere
Ilia Idakiev
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
AngularJS in 60ish Minutes
AngularJS in 60ish Minutes
Dan Wahlin
 
AngularJS Introduction
AngularJS Introduction
Carlos Morales
 
Angular js tutorial slides
Angular js tutorial slides
samhelman
 
Angularjs architecture
Angularjs architecture
Michael He
 
AngularJS intro
AngularJS intro
dizabl
 
Angular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
Understanding angular js
Understanding angular js
Aayush Shrestha
 
Introduction of angular js
Introduction of angular js
Tamer Solieman
 
AngularJS Basics
AngularJS Basics
Ravi Mone
 
Getting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
AngularJS best-practices
AngularJS best-practices
Henry Tao
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Angular JS Indtrodution
Angular JS Indtrodution
adesh21
 
Step by Step - AngularJS
Step by Step - AngularJS
Infragistics
 
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Apaichon Punopas
 
Web Components Everywhere
Web Components Everywhere
Ilia Idakiev
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
AngularJS in 60ish Minutes
AngularJS in 60ish Minutes
Dan Wahlin
 
AngularJS Introduction
AngularJS Introduction
Carlos Morales
 

Similar to Fly High With Angular - How to build an app using Angular (20)

Angular 18 course for begineers and experienced
Angular 18 course for begineers and experienced
tejaswinimysoola
 
Foster - Getting started with Angular
Foster - Getting started with Angular
MukundSonaiya1
 
Angular 2 overview in 60 minutes
Angular 2 overview in 60 minutes
Loiane Groner
 
mean stack
mean stack
michaelaaron25322
 
Angular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
Angular Up and Running Learning Angular Step by Step 1st Edition Shyam Seshadri
Angular Up and Running Learning Angular Step by Step 1st Edition Shyam Seshadri
maneskortyjt
 
Angular Presentation
Angular Presentation
Adam Moore
 
Angular Basics: A Beginner's Guide to Web Development
Angular Basics: A Beginner's Guide to Web Development
Yamunadevi K
 
Download full ebook of Angular 2 Cookbook Frisbie instant download pdf
Download full ebook of Angular 2 Cookbook Frisbie instant download pdf
kovencoitofm
 
Infosys Angular Interview Questions PDF By ScholarHat
Infosys Angular Interview Questions PDF By ScholarHat
Scholarhat
 
Instant download Angular 2 Cookbook Frisbie pdf all chapter
Instant download Angular 2 Cookbook Frisbie pdf all chapter
solvorpohlak24
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
introduction to Angularjs basics
introduction to Angularjs basics
Ravindra K
 
Angular js
Angular js
Felixits
 
Angular js
Angular js
Felixits
 
angular javascript interview questions with talent titan.pptx
angular javascript interview questions with talent titan.pptx
nathvansh89
 
Angular 2 at solutions.hamburg
Angular 2 at solutions.hamburg
Baqend
 
Angular2 + rxjs
Angular2 + rxjs
Christoffer Noring
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
Commit University
 
Angular2 with TypeScript
Angular2 with TypeScript
Rohit Bishnoi
 
Angular 18 course for begineers and experienced
Angular 18 course for begineers and experienced
tejaswinimysoola
 
Foster - Getting started with Angular
Foster - Getting started with Angular
MukundSonaiya1
 
Angular 2 overview in 60 minutes
Angular 2 overview in 60 minutes
Loiane Groner
 
Angular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
Angular Up and Running Learning Angular Step by Step 1st Edition Shyam Seshadri
Angular Up and Running Learning Angular Step by Step 1st Edition Shyam Seshadri
maneskortyjt
 
Angular Presentation
Angular Presentation
Adam Moore
 
Angular Basics: A Beginner's Guide to Web Development
Angular Basics: A Beginner's Guide to Web Development
Yamunadevi K
 
Download full ebook of Angular 2 Cookbook Frisbie instant download pdf
Download full ebook of Angular 2 Cookbook Frisbie instant download pdf
kovencoitofm
 
Infosys Angular Interview Questions PDF By ScholarHat
Infosys Angular Interview Questions PDF By ScholarHat
Scholarhat
 
Instant download Angular 2 Cookbook Frisbie pdf all chapter
Instant download Angular 2 Cookbook Frisbie pdf all chapter
solvorpohlak24
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
introduction to Angularjs basics
introduction to Angularjs basics
Ravindra K
 
Angular js
Angular js
Felixits
 
Angular js
Angular js
Felixits
 
angular javascript interview questions with talent titan.pptx
angular javascript interview questions with talent titan.pptx
nathvansh89
 
Angular 2 at solutions.hamburg
Angular 2 at solutions.hamburg
Baqend
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
Commit University
 
Angular2 with TypeScript
Angular2 with TypeScript
Rohit Bishnoi
 
Ad

Recently uploaded (20)

How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
Aarno Aukia
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
Aarno Aukia
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Ad

Fly High With Angular - How to build an app using Angular

  • 1. Fly High with Angular By Rajdeep Mandrekar & Wolfgang Furtado 
  • 3. Prerequisites ➔ Setting up the machine ◆ Install nvm (https://github.com/creationix/nvm#installation) ◆ Install node (nvm install v8.9.2) ◆ Install yarn (npm install -g yarn) ◆ Install angular-cli (npm install -g @angular/cli) ➔ Basic knowledge of HTML, CSS and JS 
  • 5. WhatisAngular? ➔ Angular is a TypeScript-based open-source front-end web application platform for dynamic web applications ➔ Created by the Angular Team at Google ➔ Provides a way to organize your HTML, JavaScript, and CSS to keep your front-end code clean.
  • 6. WhyAngular? ➔ Magical Two-Way data binding ➔ Routing Support ➔ Structured front end code ➔ Teach HTML new syntax with directives ➔ Huge community support
  • 8. 
  • 9. TypeScript ➔ Typescript is a typed superset of Javascript that compiles to plain Javascript ➔ It differentiates itself from competitors like CoffeeScript and Dart in that plain JavaScript code can be intermixed with TypeScript. Therefore JavaScript is TypeScript. ➔ JavaScript is TypeScript, but TypeScript is not JavaScript.
  • 10. TypeScript ➔ Optional static typing (the key here is optional) ➔ Type Inference, which gives some of the benefits of types, without actually using them ➔ Access to ES6 and ES7 features, before they become supported by major browsers ➔ The ability to compile down to a version of JavaScript that runs on all browsers ➔ Great tooling support with IntelliSense
  • 11. GeneratingAngularproject ➔ Use Angular CLI ➔ Why angular cli? ◆ Generates a clean project structure ◆ Auto compile code on save ◆ In-built server & compiler (error detection is fast) ◆ Manages all the npm dependencies
  • 12. GeneratingAngularproject > npm install -g @angular/cli > ng new fly-with-angular > cd fly-with-angular > ng serve
  • 16. 
  • 17. Whatisacomponent? ➔ Components are the building blocks of Angular applications. ➔ A component controls a patch of screen called a view. ➔ They easily nest one inside the other ➔ Each component may have its own: Class file, HTML file, CSS file
  • 19. Creatingacomponent > ng generate component trips-list
  • 22. Databinding Is automatic synchronization of data between the model and view components. ➔ One-way from data source to view target {{expression}} [target]="expression"
  • 23. ➔ One-way from view target to data source ➔ Two-way (event)="statement" [(target)]="expression"
  • 24. ➔ Property <img [src]="heroImageUrl"> <my-app [book]="currentBook"></my-app> <div [ngClass]="{'special': isSpecial}"></div>
  • 25. ➔ Event ➔ Attribute <button (click)="onSave()">Save</button> <img [attr.alt]="help" src="./..">
  • 26. ➔ Class ➔ Style ➔ Two-way (Banana in a box) <div [class.special]="isSpecial">Special</div> <button [style.color]="isSpecial ? 'red' : 'green'"> <input [(ngModel)]="name">
  • 30. Interface In simple words interfaces is a way of describing the shape of the JavaScript object. It helps us keep our programs error-free by providing information about the shape of the data we work with. Class: While class deals with the implementation.
  • 32. export interface Person { firstName: string; lastName: string; age: number; }
  • 34. Directives Directives is how we add dynamic behavior to HTML . There are 3 kinds of directive ➔ Components ◆ directives with a template ➔ Structural directives ◆ change the DOM layout by adding and removing DOM elements. ➔ Attribute directives ◆ change the appearance or behavior of an element, component, or another directive.
  • 35. Some most common used directives: ➔ ngIf => *ngIf="persons.length == 0" ➔ ngFor => *ngFor="let person of persons" ➔ ngSwitch/ngSwitchCase ➔ ngValue ➔ ngModel
  • 37. Pipes ➔ A pipe takes in data as input and transforms it to a desired output. ➔ Ex: DatePipe, UpperCasePipe, LowerCasePipe, CurrencyPipe, etc. {{‘abc’ | uppercase}} abc ABC
  • 39. EventBinding ➔ With event binding you can respond to any DOM event. ➔ To bind to a event binding, surround the DOM event name in parentheses and assign a quoted template statement to it. Eg. <button (click)="doAwesomeThing()">Click me!</button>
  • 40. Forms There are two ways to build forms: ➔ Reactive Forms ➔ Template-driven forms The two technologies belong to the @angular/forms library and share a common set of form control classes.
  • 41. ReactiveForms ➔ Angular reactive forms favors explicit management of the data flow between UI elements and server data. ➔ With reactive forms, you create a tree of Angular form control objects in the component class. ➔ Bind form controls to native form control elements in the component template.
  • 42. Template-drivenforms ➔ You place HTML form controls (such as <input> and <select>) in the component template and bind them to data model properties in the component, using directives like ngModel. ➔ You don't create Angular form control objects ➔ You don't push and pull data values. Angular handles that for you with ngModel ➔ Angular updates the mutable data model with user changes as they happen.
  • 43. Template-drivenvsReactiveForms ➔ Reactive forms does not mutate the data model whereas template-driven forms does. ➔ Reactive forms are synchronous. Template-driven forms are asynchronous. ➔ In template-driven forms you can't pass the validator in like you can for reactive forms. Instead, you need to add a directive to the template.
  • 45. <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name” [(ngModel)]="model.name" name="name"> </div>
  • 46. FormValidations Why validate forms? ➔ For accuracy and completeness. ➔ Form validation is required to prevent web form abuse by malicious users. ➔ Improper validation of form data is one of the main causes of security vulnerabilities. ➔ It exposes your website to attacks such as header injections, cross-site scripting, and SQL injections etc
  • 47. ValidateReactiveForms ➔ In a reactive form, the source of truth is the component class. ➔ Add validator functions directly to the form control model in the component class ➔ Angular then calls these functions whenever the value of the control changes.
  • 48. Built-inValidators ➔ min ➔ max ➔ required ➔ email ➔ minLength ➔ maxLength ➔ Pattern You can also create your custom validators and pass it to the form.

Editor's Notes

  • #4: (Why yarn? https://www.sitepoint.com/yarn-vs-npm)
  • #14: Need to show in vscode here