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

Web api
Web apiWeb api
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
Sunny Sharma
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
07.pallav
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
Aniruddha Chakrabarti
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascript
Eman Mohamed
 
Solid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJSSolid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJS
Rafael Casuso Romate
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency Injection
Dinesh Sharma
 
TypeScript
TypeScriptTypeScript
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
TypeScript
TypeScriptTypeScript
TypeScript
Saray Chak
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Amazon Web Services
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Thymeleaf
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Hitesh-Java
 
LINQ
LINQLINQ
Solid principles
Solid principlesSolid principles
Solid principles
Declan Whelan
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
Nir Kaufman
 
Dependency injection presentation
Dependency injection presentationDependency injection presentation
Dependency injection presentation
Ahasanul Kalam Akib
 

What's hot (20)

Web api
Web apiWeb api
Web api
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascript
 
Solid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJSSolid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJS
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency Injection
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
 
TypeScript
TypeScriptTypeScript
TypeScript
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Angular 9
Angular 9 Angular 9
Angular 9
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
 
LINQ
LINQLINQ
LINQ
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Dependency injection presentation
Dependency injection presentationDependency injection presentation
Dependency injection presentation
 

Similar to Angular 4 and TypeScript

Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Introduction To Angular 4 - J2I
Introduction To Angular 4 - J2IIntroduction To Angular 4 - J2I
Introduction To Angular 4 - J2I
Nader Debbabi
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
AshokKumar616995
 
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
Oleksii Prohonnyi
 
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
MobMaxime
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
dharisk
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
Rohit Bishnoi
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Malla Reddy University
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advancedAngular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
Albiorix Technology
 
Single Page Applications in SharePoint with Angular
Single Page Applications in SharePoint with AngularSingle Page Applications in SharePoint with Angular
Single Page Applications in SharePoint with Angular
Sparkhound Inc.
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
Goa App
 
Angular IO
Angular IOAngular IO
Angular IO
Jennifer Estrada
 
Angular
AngularAngular
Angular
Lilia Sfaxi
 
Mastering angular - Dot Net Tricks
Mastering angular - Dot Net TricksMastering angular - Dot Net Tricks
Mastering angular - Dot Net Tricks
Gaurav Singh
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
Mallikarjuna G D
 
Reasons to Use Typescript for Your Next Project Over Javascript.pdf
Reasons to Use Typescript for Your Next Project Over Javascript.pdfReasons to Use Typescript for Your Next Project Over Javascript.pdf
Reasons to Use Typescript for Your Next Project Over Javascript.pdf
MobMaxime
 
Dust.js
Dust.jsDust.js

Similar to Angular 4 and TypeScript (20)

Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
 
Introduction To Angular 4 - J2I
Introduction To Angular 4 - J2IIntroduction To Angular 4 - J2I
Introduction To Angular 4 - J2I
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
 
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
 
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
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advancedAngular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
 
How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
 
Single Page Applications in SharePoint with Angular
Single Page Applications in SharePoint with AngularSingle Page Applications in SharePoint with Angular
Single Page Applications in SharePoint with Angular
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
Angular IO
Angular IOAngular IO
Angular IO
 
Angular
AngularAngular
Angular
 
Mastering angular - Dot Net Tricks
Mastering angular - Dot Net TricksMastering angular - Dot Net Tricks
Mastering angular - Dot Net Tricks
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
 
Reasons to Use Typescript for Your Next Project Over Javascript.pdf
Reasons to Use Typescript for Your Next Project Over Javascript.pdfReasons to Use Typescript for Your Next Project Over Javascript.pdf
Reasons to Use Typescript for Your Next Project Over Javascript.pdf
 
Dust.js
Dust.jsDust.js
Dust.js
 

Recently uploaded

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 

Recently uploaded (20)

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 

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