SlideShare a Scribd company logo
Getting Started with
Angular 4 and
TypeScript
INTRODUCTION BY AHMED LOTFY EL-KADY
1
What is TypeScript ?
TypeScript is a typed superset of
JavaScript that compiles to plain
JavaScript.
2
TypeScript Content
๏‚งWhy TypeScript ?
๏‚งInterfaces
๏‚งClasses
๏‚งDecorators
๏‚งImport and Export
3
Why TypeScript ?
โ€ขTypeScript Has Great Tools
โ€ขTypeScript is a Superset of JavaScript
โ€ขTypeScript Makes Abstractions Explicit
โ€ขTypeScript Makes Code Easier to Read and Understand
4
TypeScript Interfaces
5
TypeScript Decorators
Like attributes in C#
6
Import and Export
๏‚งLike using statements in C#
๏‚งimport statements allow us to reference code from other TypeScript files
๏‚งexport simply means public
7
What is Angular JS ?
A JavaScript framework For
building client-side applications
Using HTML, CSS and JavaScript
8
Angular Architecture Overview
9
Anatomy of an Angular Application
Application Component Component Component
Services
10
Setting up an Angular Application
1. Install NodeJS And NPM
2. Create an application folder
3. Create the tsconfig.json file
4. Create the package.json file
5. Create the typings.json file
6. Install the libraries and typings
7. Create the host Web page (index.html)
8. Create the main.ts file (bootstrapper)
11
Angular CLI
1. npm install -g @angular/cli
2. ng new PROJECT_NAME
3. cd PROJECT_NAME
4. ng serve
12
Running your application
๏‚งImport your root NgModule
๏‚งBootstrap it!
13
Modules
๏‚งAngular apps are modular and Angular has its own modularity system called Angular modules or
NgModules.
๏‚งEvery Angular app has at least one Angular module class, the root module, conventionally
named AppModule
๏‚งAngular ships as a collection of JavaScript modules. You can think of them as library modules.
Each Angular library name begins with the @angular prefix
๏‚งYou install them with the npm package manager and import parts of them with JavaScript
Import statements.
14
Components
15
Component Template
Class
Properties
Methods
Metadata
Components
16
Templates
๏‚งYou define a component's view with its companion template. A template is a form of HTML that
tells Angular how to render the component.
17
Metadata
๏‚งMetadata tells Angular how to process a class.
๏‚งIn TypeScript, you attach metadata by using a decorator.
๏‚งThe template, metadata, and component together describe a view.
๏‚งThe metadata in the @Component tells Angular where to get the major building blocks you
specify for the component.
๏‚งApply other metadata decorators in a similar fashion to guide Angular behavior. @Injectable,
@Input and @Output are a few of the more popular decorators.
18
Data binding
Angular supports data binding, a mechanism
for coordinating parts of a template with parts
of a component. Add binding markup to the
template HTML to tell Angular how to connect
both sides.
There are four forms of data binding syntax.
Each form has a direction โ€” to the DOM, from
the DOM, or in both directions.
19
Pipes
Pipes are used in the templates to improve the user experience by transforming
values for display.
Example:
{{ price | currency:'USD':true }}
It displays a price of 42.33 as $42.33
20
Services
๏‚งServices are best used to create, read, update and delete data
๏‚งEnforces separation of concerns
๏‚งThink of it like this: you donโ€™t want your database in your view!
21
Service Creation
Step 1 โ€“ Make class with data
22
Service Creation
Step 2 โ€“ Import @Injectable and decorate
23
Service Creation
Steps 3 and 4 โ€“ Import and register
24
Service Creation
Step 5 โ€“ Add as property and to constructor
25
Thank You!
26

More Related Content

What's hot (20)

PDF
Nodejs presentation
Arvind Devaraj
ย 
PPTX
Angular 2
Nigam Goyal
ย 
PDF
OpenAPI and gRPC Side by-Side
Tim Burks
ย 
PPTX
ReactJS presentation.pptx
DivyanshGupta922023
ย 
PPTX
Angular
Mouad EL Fakir
ย 
PDF
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
ย 
PPTX
Intro to React
Justin Reock
ย 
PPTX
An Introduction To REST API
Aniruddh Bhilvare
ย 
PDF
Spring Security
Knoldus Inc.
ย 
PPTX
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
ย 
PPT
Angular Introduction By Surekha Gadkari
Surekha Gadkari
ย 
PDF
Basics of React Hooks.pptx.pdf
Knoldus Inc.
ย 
PDF
Testing Angular
Lilia Sfaxi
ย 
PDF
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
ย 
PPTX
TypeScript Overview
Aniruddha Chakrabarti
ย 
PPTX
Spring Framework
tola99
ย 
PDF
Angular - Chapter 5 - Directives
WebStackAcademy
ย 
PDF
Spring Boot
Jaran Flaath
ย 
PPTX
Postman Collection Format v2.0 (pre-draft)
Postman
ย 
Nodejs presentation
Arvind Devaraj
ย 
Angular 2
Nigam Goyal
ย 
OpenAPI and gRPC Side by-Side
Tim Burks
ย 
ReactJS presentation.pptx
DivyanshGupta922023
ย 
Angular
Mouad EL Fakir
ย 
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
ย 
Intro to React
Justin Reock
ย 
An Introduction To REST API
Aniruddh Bhilvare
ย 
Spring Security
Knoldus Inc.
ย 
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
ย 
Angular Introduction By Surekha Gadkari
Surekha Gadkari
ย 
Basics of React Hooks.pptx.pdf
Knoldus Inc.
ย 
Testing Angular
Lilia Sfaxi
ย 
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
ย 
TypeScript Overview
Aniruddha Chakrabarti
ย 
Spring Framework
tola99
ย 
Angular - Chapter 5 - Directives
WebStackAcademy
ย 
Spring Boot
Jaran Flaath
ย 
Postman Collection Format v2.0 (pre-draft)
Postman
ย 

Similar to Angular 4 and TypeScript (20)

PPTX
Angularjs2 presentation
dharisk
ย 
PPTX
Angularj2.0
Mallikarjuna G D
ย 
PPTX
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
ย 
PDF
Introduction To Angular 4 - J2I
Nader Debbabi
ย 
PPTX
Angular 5 presentation for beginners
Imran Qasim
ย 
PPTX
An Overview of Angular 4
Cynoteck Technology Solutions Private Limited
ย 
PPTX
Introduction to Angular2
Knoldus Inc.
ย 
PPTX
Angular4 getting started
TejinderMakkar
ย 
PPTX
Angular Basics.pptx
AshokKumar616995
ย 
PPT
17612235.ppt
yovixi5669
ย 
PPTX
Angular Course.pptx
Imdad Ullah
ย 
PPTX
Foster - Getting started with Angular
MukundSonaiya1
ย 
PDF
Angular
Vinod Kumar Kayartaya
ย 
PPTX
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
ย 
PDF
Building blocks of Angular
Knoldus Inc.
ย 
PPTX
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
ย 
PPTX
Angular
khoado2002
ย 
PDF
Angular2
SitaPrajapati
ย 
PDF
Angular 2 introduction
Christoffer Noring
ย 
PDF
Angular2 with type script
Ravi Mone
ย 
Angularjs2 presentation
dharisk
ย 
Angularj2.0
Mallikarjuna G D
ย 
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
ย 
Introduction To Angular 4 - J2I
Nader Debbabi
ย 
Angular 5 presentation for beginners
Imran Qasim
ย 
An Overview of Angular 4
Cynoteck Technology Solutions Private Limited
ย 
Introduction to Angular2
Knoldus Inc.
ย 
Angular4 getting started
TejinderMakkar
ย 
Angular Basics.pptx
AshokKumar616995
ย 
17612235.ppt
yovixi5669
ย 
Angular Course.pptx
Imdad Ullah
ย 
Foster - Getting started with Angular
MukundSonaiya1
ย 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
ย 
Building blocks of Angular
Knoldus Inc.
ย 
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
ย 
Angular
khoado2002
ย 
Angular2
SitaPrajapati
ย 
Angular 2 introduction
Christoffer Noring
ย 
Angular2 with type script
Ravi Mone
ย 
Ad

Recently uploaded (20)

PPTX
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
PPTX
CV-Project_2024 version 01222222222.pptx
MohammadSiddiqui70
ย 
PDF
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
ย 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
ย 
PDF
Alur Perkembangan Software dan Jaringan Komputer
ssuser754303
ย 
PDF
From Data Preparation to Inference: How Alluxio Speeds Up AI
Alluxio, Inc.
ย 
PPTX
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
ย 
PDF
Code Once; Run Everywhere - A Beginnerโ€™s Journey with React Native
Hasitha Walpola
ย 
PDF
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
PDF
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
ย 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
PPTX
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
PDF
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
PDF
Which Hiring Management Tools Offer the Best ROI?
HireME
ย 
PPTX
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
ย 
PDF
Mastering VPC Architecture Build for Scale from Day 1.pdf
Devseccops.ai
ย 
PPTX
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
ย 
PPTX
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
ย 
PPTX
Introduction to web development | MERN Stack
JosephLiyon
ย 
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
CV-Project_2024 version 01222222222.pptx
MohammadSiddiqui70
ย 
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
ย 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
ย 
Alur Perkembangan Software dan Jaringan Komputer
ssuser754303
ย 
From Data Preparation to Inference: How Alluxio Speeds Up AI
Alluxio, Inc.
ย 
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
ย 
Code Once; Run Everywhere - A Beginnerโ€™s Journey with React Native
Hasitha Walpola
ย 
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
ย 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
Which Hiring Management Tools Offer the Best ROI?
HireME
ย 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
ย 
Mastering VPC Architecture Build for Scale from Day 1.pdf
Devseccops.ai
ย 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
ย 
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
ย 
Introduction to web development | MERN Stack
JosephLiyon
ย 
Ad

Angular 4 and TypeScript

  • 1. Getting Started with Angular 4 and TypeScript INTRODUCTION BY AHMED LOTFY EL-KADY 1
  • 2. What is TypeScript ? TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. 2
  • 3. TypeScript Content ๏‚งWhy TypeScript ? ๏‚งInterfaces ๏‚งClasses ๏‚งDecorators ๏‚งImport and Export 3
  • 4. Why TypeScript ? โ€ขTypeScript Has Great Tools โ€ขTypeScript is a Superset of JavaScript โ€ขTypeScript Makes Abstractions Explicit โ€ขTypeScript Makes Code Easier to Read and Understand 4
  • 7. Import and Export ๏‚งLike using statements in C# ๏‚งimport statements allow us to reference code from other TypeScript files ๏‚งexport simply means public 7
  • 8. What is Angular JS ? A JavaScript framework For building client-side applications Using HTML, CSS and JavaScript 8
  • 10. Anatomy of an Angular Application Application Component Component Component Services 10
  • 11. Setting up an Angular Application 1. Install NodeJS And NPM 2. Create an application folder 3. Create the tsconfig.json file 4. Create the package.json file 5. Create the typings.json file 6. Install the libraries and typings 7. Create the host Web page (index.html) 8. Create the main.ts file (bootstrapper) 11
  • 12. Angular CLI 1. npm install -g @angular/cli 2. ng new PROJECT_NAME 3. cd PROJECT_NAME 4. ng serve 12
  • 13. Running your application ๏‚งImport your root NgModule ๏‚งBootstrap it! 13
  • 14. Modules ๏‚งAngular apps are modular and Angular has its own modularity system called Angular modules or NgModules. ๏‚งEvery Angular app has at least one Angular module class, the root module, conventionally named AppModule ๏‚งAngular ships as a collection of JavaScript modules. You can think of them as library modules. Each Angular library name begins with the @angular prefix ๏‚งYou install them with the npm package manager and import parts of them with JavaScript Import statements. 14
  • 17. Templates ๏‚งYou define a component's view with its companion template. A template is a form of HTML that tells Angular how to render the component. 17
  • 18. Metadata ๏‚งMetadata tells Angular how to process a class. ๏‚งIn TypeScript, you attach metadata by using a decorator. ๏‚งThe template, metadata, and component together describe a view. ๏‚งThe metadata in the @Component tells Angular where to get the major building blocks you specify for the component. ๏‚งApply other metadata decorators in a similar fashion to guide Angular behavior. @Injectable, @Input and @Output are a few of the more popular decorators. 18
  • 19. Data binding Angular supports data binding, a mechanism for coordinating parts of a template with parts of a component. Add binding markup to the template HTML to tell Angular how to connect both sides. There are four forms of data binding syntax. Each form has a direction โ€” to the DOM, from the DOM, or in both directions. 19
  • 20. Pipes Pipes are used in the templates to improve the user experience by transforming values for display. Example: {{ price | currency:'USD':true }} It displays a price of 42.33 as $42.33 20
  • 21. Services ๏‚งServices are best used to create, read, update and delete data ๏‚งEnforces separation of concerns ๏‚งThink of it like this: you donโ€™t want your database in your view! 21
  • 22. Service Creation Step 1 โ€“ Make class with data 22
  • 23. Service Creation Step 2 โ€“ Import @Injectable and decorate 23
  • 24. Service Creation Steps 3 and 4 โ€“ Import and register 24
  • 25. Service Creation Step 5 โ€“ Add as property and to constructor 25