SlideShare a Scribd company logo
1 of 26
TypeScript & Angular 2
Love at first sight
igor.talevski@IT-Labs.com
aleksandar.pavlovski@IT-Labs.com
the future of JavaScript, now
TypeScript
The feature gap
The feature gap
TypeScript
• Free and open-source programming language developed and maintained by Microsoft.
• Designed for development of large applications; transcompiles to JavaScript.
• Superset of JavaScript; any existing JavaScript programs are also valid TypeScript programs.
• Supports definition files that can contain type information of existing JavaScript libraries.
• TypeScript compiler is itself written in TypeScript.
• TypeScript is included as a first-class programming language in Microsoft Visual Studio 2013 Update 2
and later.
Why add types to JavaScript?
• Types increase your agility when doing refactoring.
It's better for the compiler to catch errors than to have things fail at runtime.
• Types are one of the best forms of documentation you can have.
The function signature is a theorem, and the function body is the proof.
Basic Types
Boolean
Number
String
Array
Tuple
Enum
Any
Template Strings
• Multiline Strings
• String Interpolation
• Tagged Templates
Arrow Functions
I hate JavaScript, as it tends to lose the meaning of this all too easily!
• You don't need to keep typing function.
• It lexically captures the meaning of this.
• It lexically captures the meaning of
arguments.
Things to Know about TypeScript
• Types
• Interfaces
• Annotations/Decorators
• async/await
• Classes
• Access Modifiers and Properties
• Modules
• Static and Instance Members
• Function Overloading*
• Generics
• Constructors
• Inheritance
• Interfaces
“We love TypeScript for many things… With TypeScript, several of our team members have said things
like ‘I now actually understand most of our own code!’ because they can easily traverse it and
understand relationships much better. And we’ve found several bugs via TypeScript’s checks. “
– Brad Green, Engineering Director - AngularJS
Angular <3 TypeScript
Transitioning from Angrular 1?
So, you've skimmed a few lines of this new shiny Angular 2.0 thing, and you were like...
Why Angular 2?
• Written in TypeScript.
• One framework. Mobile & desktop.
• Leading SPA framework with “batteries included”.
• Universal. Serve the first view from .NET, node.js, PHP for instant rendering in HTML and CSS.
• Built on five years of community feedback.
• By focusing on standards, we get twice the power with half the framework.
Building blocks
• Modules
• Components
• Services
• Directives
• Data Binding
• Dependency Injection
Basic Component
import { MyService } from ‘./my.service.ts’;
@Component({
selector: ‘my-component’,
template: `
<h1>{{title}}</h1>
`
})
export class MyComponent {
constructor(public myService: MyService) {…}
}
Data Binding
ComponentTemplate
Interpolation
{{value}}
Property Binding
[property]=“value”
Event Binding
(event)=“handler”
Two Way Binding
[(ngModel)]=“value”
Template syntax
• Interpolation – {{expression}}
• Method Binding - (event)=“expression”
• Property Binding - [property]=“expression”
• Two Way Binding - [(target)]=“expression”
• Hashtag Operator - #item – local variable in the template scope.
• Asterisk Operator - *ngIf – a directive that modifies the HTML.
• Elvis Operator (?.) – {{component?.property}} – safe navigation operator.
Architectural Best Practices
• Include all files pertinent to a component in the same folder.
• Remember CIDER for creating components:
• Create class,
• Import dependencies,
• Decorate class,
• Enhance with composition,
• Repeat for sub-components.
• Keep templates small enough to put the main component directly into the file.
• Delegate business logic from the component to a service.
• Don’t be afraid to split a component up if it’s growing too large.
• Lazy loading.
• Server-side rendering (Universal)
• Native mobile applications (NativeScript)
• Web Browser
• Desktop App (Electron)
• Progressive web apps (web workers, cache, push, offline)
• Hybrid mobile apps (ionic)
One platform to rule them all
Learning resources
https://mva.microsoft.com - Microsoft Virtual Academy
https://www.typescriptlang.org - State of the art JavaScript
https://angular.io - A step-by-step which introduces the major features of Angular
Thank You!
igor.talevski@it-labs.com
aleksandar.pavlovski@it-labs.com
http://it-labs.com

More Related Content

What's hot

Ember JS - Why Ember Matches My Wavelength
Ember JS - Why Ember Matches My WavelengthEmber JS - Why Ember Matches My Wavelength
Ember JS - Why Ember Matches My WavelengthLohith Goudagere Nagaraj
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptGil Fink
 
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSébastien Levert
 
From Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, LvivFrom Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, LvivAndrzej Krzywda
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...Sébastien Levert
 
UPenn on Rails intro
UPenn on Rails introUPenn on Rails intro
UPenn on Rails introMat Schaffer
 
Using JavaScript Libraries like D3.js with WordPress
Using JavaScript Libraries like D3.js with WordPressUsing JavaScript Libraries like D3.js with WordPress
Using JavaScript Libraries like D3.js with WordPressJohn Cook
 
Refactoring Rails applications with RubyMine
Refactoring Rails applications with RubyMineRefactoring Rails applications with RubyMine
Refactoring Rails applications with RubyMineAndrzej Krzywda
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...Sébastien Levert
 
[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming API[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming APICocoaHeads Tricity
 
Stencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven ZelekStencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven ZelekIlyaDmitriev11
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Trung Vo Tuan
 
Evolving your api architecture with the strangler pattern
Evolving your api architecture with the strangler patternEvolving your api architecture with the strangler pattern
Evolving your api architecture with the strangler patterndwcarter74
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?Troy Miles
 
Modern java script features
Modern java script featuresModern java script features
Modern java script featuresKunal Kursija
 
Angular: An Introduction
Angular: An IntroductionAngular: An Introduction
Angular: An IntroductionAlex Hoffman
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Dawid Myslak
 

What's hot (20)

Ember JS - Why Ember Matches My Wavelength
Ember JS - Why Ember Matches My WavelengthEmber JS - Why Ember Matches My Wavelength
Ember JS - Why Ember Matches My Wavelength
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScript
 
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
 
From Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, LvivFrom Rails legacy to DDD - Pivorak, Lviv
From Rails legacy to DDD - Pivorak, Lviv
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
 
UPenn on Rails intro
UPenn on Rails introUPenn on Rails intro
UPenn on Rails intro
 
Using JavaScript Libraries like D3.js with WordPress
Using JavaScript Libraries like D3.js with WordPressUsing JavaScript Libraries like D3.js with WordPress
Using JavaScript Libraries like D3.js with WordPress
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
 
Refactoring Rails applications with RubyMine
Refactoring Rails applications with RubyMineRefactoring Rails applications with RubyMine
Refactoring Rails applications with RubyMine
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
 
Scaffolding in One Asp.Net
Scaffolding in One Asp.NetScaffolding in One Asp.Net
Scaffolding in One Asp.Net
 
[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming API[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming API
 
Stencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven ZelekStencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven Zelek
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Evolving your api architecture with the strangler pattern
Evolving your api architecture with the strangler patternEvolving your api architecture with the strangler pattern
Evolving your api architecture with the strangler pattern
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
 
Modern java script features
Modern java script featuresModern java script features
Modern java script features
 
Angular: An Introduction
Angular: An IntroductionAngular: An Introduction
Angular: An Introduction
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 

Viewers also liked (15)

04 Song of Solomon 1v 2-7 Love at First Sight
04 Song of Solomon 1v 2-7  Love at First Sight04 Song of Solomon 1v 2-7  Love at First Sight
04 Song of Solomon 1v 2-7 Love at First Sight
 
Love At First Sight
Love At First SightLove At First Sight
Love At First Sight
 
LOVE
LOVELOVE
LOVE
 
Statistic1
Statistic1Statistic1
Statistic1
 
Love and fear
Love and fearLove and fear
Love and fear
 
The Psychology of Love
The Psychology of LoveThe Psychology of Love
The Psychology of Love
 
Love At First Sight
Love At First SightLove At First Sight
Love At First Sight
 
What Is Love
What Is LoveWhat Is Love
What Is Love
 
The love emotion vs. the love relationship
 The love emotion vs. the love relationship  The love emotion vs. the love relationship
The love emotion vs. the love relationship
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Let’s talk about love
Let’s talk about loveLet’s talk about love
Let’s talk about love
 
A More Loving Person
A More Loving PersonA More Loving Person
A More Loving Person
 
Change the world
Change the worldChange the world
Change the world
 
Love
LoveLove
Love
 
Love Presentation
Love PresentationLove Presentation
Love Presentation
 

Similar to TypeScript and Angular2 (Love at first sight)

The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript Corley S.r.l.
 
Angular 2 with typescript
Angular 2 with typescriptAngular 2 with typescript
Angular 2 with typescriptTayseer_Emam
 
Angular Owin Katana TypeScript
Angular Owin Katana TypeScriptAngular Owin Katana TypeScript
Angular Owin Katana TypeScriptJustin Wendlandt
 
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.pptxMalla Reddy University
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Phil Leggetter
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code ReviewMilan Vukoje
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesUlrich Krause
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCUlrich Krause
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadAPIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadSoftware Guru
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET Dmytro Mindra
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friendFilip Bruun Bech-Larsen
 
How to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJSHow to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJSPhil Leggetter
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and FrameworkChandrasekar G
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierMiroslav Resetar
 

Similar to TypeScript and Angular2 (Love at first sight) (20)

The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
 
Angular 2 with typescript
Angular 2 with typescriptAngular 2 with typescript
Angular 2 with typescript
 
Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
 
Angular 2
Angular 2Angular 2
Angular 2
 
Angular Owin Katana TypeScript
Angular Owin Katana TypeScriptAngular Owin Katana TypeScript
Angular Owin Katana 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
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
Welcome to React.pptx
Welcome to React.pptxWelcome to React.pptx
Welcome to React.pptx
 
Dust.js
Dust.jsDust.js
Dust.js
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code Review
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPages
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVC
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadAPIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
 
How to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJSHow to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJS
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlier
 

Recently uploaded

A Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air CoolerA Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air Coolerenquirieskenstar
 
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxEngaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxAsifArshad8
 
Early Modern Spain. All about this period
Early Modern Spain. All about this periodEarly Modern Spain. All about this period
Early Modern Spain. All about this periodSaraIsabelJimenez
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationNathan Young
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...漢銘 謝
 
Internship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SEInternship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SESaleh Ibne Omar
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per MVidyaAdsule1
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitysandeepnani2260
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRachelAnnTenibroAmaz
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRRsarwankumar4524
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxRoquia Salam
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comsaastr
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptxogubuikealex
 
Quality by design.. ppt for RA (1ST SEM
Quality by design.. ppt for  RA (1ST SEMQuality by design.. ppt for  RA (1ST SEM
Quality by design.. ppt for RA (1ST SEMCharmi13
 
proposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeegerproposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeegerkumenegertelayegrama
 

Recently uploaded (17)

A Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air CoolerA Guide to Choosing the Ideal Air Cooler
A Guide to Choosing the Ideal Air Cooler
 
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxEngaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
 
Early Modern Spain. All about this period
Early Modern Spain. All about this periodEarly Modern Spain. All about this period
Early Modern Spain. All about this period
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism Presentation
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
 
Internship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SEInternship Presentation | PPT | CSE | SE
Internship Presentation | PPT | CSE | SE
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per M
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber security
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptx
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptx
 
Quality by design.. ppt for RA (1ST SEM
Quality by design.. ppt for  RA (1ST SEMQuality by design.. ppt for  RA (1ST SEM
Quality by design.. ppt for RA (1ST SEM
 
proposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeegerproposal kumeneger edited.docx A kumeeger
proposal kumeneger edited.docx A kumeeger
 

TypeScript and Angular2 (Love at first sight)

  • 1. TypeScript & Angular 2 Love at first sight igor.talevski@IT-Labs.com aleksandar.pavlovski@IT-Labs.com
  • 2.
  • 3.
  • 4. the future of JavaScript, now TypeScript
  • 7. TypeScript • Free and open-source programming language developed and maintained by Microsoft. • Designed for development of large applications; transcompiles to JavaScript. • Superset of JavaScript; any existing JavaScript programs are also valid TypeScript programs. • Supports definition files that can contain type information of existing JavaScript libraries. • TypeScript compiler is itself written in TypeScript. • TypeScript is included as a first-class programming language in Microsoft Visual Studio 2013 Update 2 and later.
  • 8. Why add types to JavaScript? • Types increase your agility when doing refactoring. It's better for the compiler to catch errors than to have things fail at runtime. • Types are one of the best forms of documentation you can have. The function signature is a theorem, and the function body is the proof.
  • 10. Template Strings • Multiline Strings • String Interpolation • Tagged Templates
  • 11. Arrow Functions I hate JavaScript, as it tends to lose the meaning of this all too easily! • You don't need to keep typing function. • It lexically captures the meaning of this. • It lexically captures the meaning of arguments.
  • 12. Things to Know about TypeScript • Types • Interfaces • Annotations/Decorators • async/await • Classes • Access Modifiers and Properties • Modules • Static and Instance Members • Function Overloading* • Generics • Constructors • Inheritance • Interfaces
  • 13.
  • 14.
  • 15. “We love TypeScript for many things… With TypeScript, several of our team members have said things like ‘I now actually understand most of our own code!’ because they can easily traverse it and understand relationships much better. And we’ve found several bugs via TypeScript’s checks. “ – Brad Green, Engineering Director - AngularJS Angular <3 TypeScript
  • 16. Transitioning from Angrular 1? So, you've skimmed a few lines of this new shiny Angular 2.0 thing, and you were like...
  • 17. Why Angular 2? • Written in TypeScript. • One framework. Mobile & desktop. • Leading SPA framework with “batteries included”. • Universal. Serve the first view from .NET, node.js, PHP for instant rendering in HTML and CSS. • Built on five years of community feedback. • By focusing on standards, we get twice the power with half the framework.
  • 18. Building blocks • Modules • Components • Services • Directives • Data Binding • Dependency Injection
  • 19. Basic Component import { MyService } from ‘./my.service.ts’; @Component({ selector: ‘my-component’, template: ` <h1>{{title}}</h1> ` }) export class MyComponent { constructor(public myService: MyService) {…} }
  • 20. Data Binding ComponentTemplate Interpolation {{value}} Property Binding [property]=“value” Event Binding (event)=“handler” Two Way Binding [(ngModel)]=“value”
  • 21. Template syntax • Interpolation – {{expression}} • Method Binding - (event)=“expression” • Property Binding - [property]=“expression” • Two Way Binding - [(target)]=“expression” • Hashtag Operator - #item – local variable in the template scope. • Asterisk Operator - *ngIf – a directive that modifies the HTML. • Elvis Operator (?.) – {{component?.property}} – safe navigation operator.
  • 22. Architectural Best Practices • Include all files pertinent to a component in the same folder. • Remember CIDER for creating components: • Create class, • Import dependencies, • Decorate class, • Enhance with composition, • Repeat for sub-components. • Keep templates small enough to put the main component directly into the file. • Delegate business logic from the component to a service. • Don’t be afraid to split a component up if it’s growing too large. • Lazy loading.
  • 23. • Server-side rendering (Universal) • Native mobile applications (NativeScript) • Web Browser • Desktop App (Electron) • Progressive web apps (web workers, cache, push, offline) • Hybrid mobile apps (ionic) One platform to rule them all
  • 24. Learning resources https://mva.microsoft.com - Microsoft Virtual Academy https://www.typescriptlang.org - State of the art JavaScript https://angular.io - A step-by-step which introduces the major features of Angular
  • 25.