SlideShare a Scribd company logo
1 of 33
Download to read offline
Angular 2 Overview
Alexander Shevnin, JSC “Arcadia Inc.”
About myself
2
Alexander Shevnin
JSC “Arcadia Inc.”
alexander.shevnin@arcadia.spb.ru
In Arcadia from 2012, last 3 years work mostly with
ASP.NET, C#, AngularJS and TypeScript
Intro 
• New major version of Angular framework from Google
• Single Page Applications
• Built from scratch
• Written on Typescript
• Can run in web worker or server-side
• Npm packages: @angular/*
3
Topics for today:
• Core concepts
• A bit about Reactive programming
• What do I need to use it today (dependencies, browser
compatibility and so on)?
• JIT vs AOT (brief look at compilation)
4
This is NOT about:
• Copying api-documentation
• Comparison with other libraries / frameworks (save for ng1 ;) )
5
Coming from ng1
• Forget everything that you think you know
• No more controllers, services, factories, providers
• No digest loop (no $scope.$apply() at least)
• No $scope at all ;)
• Still having directives though. Much easier to deal with.
6
Hello world
7
• https://embed.plnkr.co/?show=preview&show=app%2Fapp.component.ts
• https://angular.io/docs/ts/latest/quickstart.html
Same functionality in ES5 
8
Data Binding
9
https://plnkr.co/edit/RtrRej?p=preview http://blog.thoughtram.io/angular/2016/10/13/two-way-data-
binding-in-angular-2.html
Data Binding
10
Dependency Injection
11
Component lifecycle
12
Components interaction
• Shared service (hello ng1 ;) )
• @Input/@Output
• ngOnChanges(changes: {[propKey: string]: SimpleChange})
• We can place a local variable on the tag representing the child component
<button (click)="timer.start()">Start</button>
<countdown-timer #timer> </countdown-timer>
• Obtain a link to a child component using @ViewChild:
13
https://angular.io/docs/ts/latest/cookbook/component-communication.html
RxJS
• Reactive Programming
• Implements https://github.com/tc39/proposal-observable
• The Observable type can be used to model push-based data sources such
as DOM events, timer intervals, and sockets.
• Observables can be composed with higher-order combinators.
• Observables do not start emitting data until an observer has subscribed.
• ...is a set of libraries to compose asynchronous and event-based programs using
observable collections and Array#extras style composition in JavaScript
• Observables + Operators + Schedulers
• Can wrap promises, observables, events and provides exception handling and
cancellation
14
https://www.youtube.com/watch?v=R4sTvHXkToQ you might have seen it already 
https://www.youtube.com/watch?v=KOOT7BArVHQ RxJS In-Depth @ AngularConnect
You’ve seen it already
15
Simple example
16
Consider a task
• Given input textbox and api (GET /items?<term>)
• Call it upon user’s input
• Display results
17
Sounds too easy?
How about this?
1. Don’t hit the search endpoint on every key stroke
2. Don’t hit the search endpoint with the same query params
for subsequent requests
3. Deal with out-of-order responses
4. Cancel requests when they are not needed
18
19
Change Detection
20
Let’s take a look back
21
http://blog.mgechev.com/2016/08/14/ahead-of-time-compilation-angular-offline-precompilation/
Zone.JS
• Execution context
• State changes
• Events (click, change, submit…)
• XMLHttpRequests
• Timers (setTimeout, setInterval)
• Monkey-patching on globalScope (Zone.setTimeout)
• No $digest / $apply
• https://www.youtube.com/watch?v=3IqtmUscE_U - good talk about
Zones
22
Change detection
• https://vsavkin.com/change-detection-in-angular-2-4f216b855d4c#.yd0nbcphd
23
Change detection
• https://vsavkin.com/change-detection-in-angular-2-4f216b855d4c#.yd0nbcphd
24
NG2 Compiler
• Generated ViewClasses (no need to parse views all the time)
• Inline class properties (google for Hidden Classes)
25
Use immutable objects
26
• https://vsavkin.com/change-detection-in-angular-2-4f216b855d4c#.yd0nbcphd
JIT Pipeline
1. Write some TypeScript
2. Compile it
3. Bundle
4. Minify
5. Deploy
1. Download application
2. Bootstrap application
3. Compile / generate each view
4. Render application
27
AOT Pipeline
1. Write some TypeScript
2. Compile templates -> generate TypeScript code
3. Compile TypeScript to JavaScript
4. Bundle
5. Minify
6. Deploy
1. Download application
2. Bootstrap application
3. Render application
28
Why even bother?
• Faster page load
• Bundle size
• Strongly-typed ViewClasses
• Can take the best of Google Closure Compiler
• https://w3c.github.io/webappsec-csp/ Content Security Policy
• Energy efficiency
29
JIT AOT
Routing
30
https://vsavkin.com/angular-2-router-d9e30599f9ea#.gyrajhshr
Dependencies
• Core -> Zone.js, Reflect-Metadata, Observables, Promises
• Promises -> native / shims (es6-shim)
• Observables-> RxJS
• Modules -> Module builder / loader (SystemJS, Browserify,
Webpack 1/2)
• AOT -> Typescript, ES2015 modules (no commonjs, no
webpack 1.0)
31
References:
• https://angular.io/
• https://github.com/mgechev/angular-seed - Modular starter project for Angular 2 with
statically typed build and AoT compilation
• https://vsavkin.com/ - site full of useful articles on the topic
• https://leanpub.com/router – a book on Angular 2 router
• http://blog.thoughtram.io/angular/2016/01/06/taking-advantage-of-observables-in-
angular2.html - more on observables example
• http://blog.mgechev.com/2016/08/14/ahead-of-time-compilation-angular-offline-
precompilation/ ahead-of-time compilation
32
Q & A

More Related Content

What's hot

What’s new in angular 2
What’s new in angular 2What’s new in angular 2
What’s new in angular 2
Ran Wahle
 

What's hot (20)

Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
 
Getting Started with Angular 2
Getting Started with Angular 2Getting Started with Angular 2
Getting Started with Angular 2
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la force
 
Tech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkTech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new framework
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular2
Angular2Angular2
Angular2
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
What’s new in angular 2
What’s new in angular 2What’s new in angular 2
What’s new in angular 2
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Angular 2 Crash Course
Angular  2 Crash CourseAngular  2 Crash Course
Angular 2 Crash Course
 
Talk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG BéninTalk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG Bénin
 

Viewers also liked

AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...
AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...
AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...
JSC “Arcadia Inc”
 
AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...
AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...
AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...
JSC “Arcadia Inc”
 

Viewers also liked (18)

AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...
AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...
AzovDevMeetup 2016 | Машинное обучение, параллельные и распределённые вычисле...
 
AzovDevMeetup 2016 | HBase и Phoenix в качестве основы ETL-приложения на Node...
AzovDevMeetup 2016 | HBase и Phoenix в качестве основы ETL-приложения на Node...AzovDevMeetup 2016 | HBase и Phoenix в качестве основы ETL-приложения на Node...
AzovDevMeetup 2016 | HBase и Phoenix в качестве основы ETL-приложения на Node...
 
AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...
AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...
AzovDevMeetup 2016 | Zero downtime — как релизить продукт миллионам пользоват...
 
AzovDevMeetup 2016 | Основы Agile Project Management или Прощай, менеджер про...
AzovDevMeetup 2016 | Основы Agile Project Management или Прощай, менеджер про...AzovDevMeetup 2016 | Основы Agile Project Management или Прощай, менеджер про...
AzovDevMeetup 2016 | Основы Agile Project Management или Прощай, менеджер про...
 
AzovDevMeetup 2016 | Выстраивание процесса и применение Best Practices с нуля...
AzovDevMeetup 2016 | Выстраивание процесса и применение Best Practices с нуля...AzovDevMeetup 2016 | Выстраивание процесса и применение Best Practices с нуля...
AzovDevMeetup 2016 | Выстраивание процесса и применение Best Practices с нуля...
 
AzovDevMeetup 2016 | Сертификация ISTQB для QA инженера | Артём Кравченко
AzovDevMeetup 2016 | Сертификация ISTQB для QA инженера | Артём КравченкоAzovDevMeetup 2016 | Сертификация ISTQB для QA инженера | Артём Кравченко
AzovDevMeetup 2016 | Сертификация ISTQB для QA инженера | Артём Кравченко
 
Using zone.js
Using zone.jsUsing zone.js
Using zone.js
 
Angular 2 a traveler's diary
Angular 2   a traveler's diaryAngular 2   a traveler's diary
Angular 2 a traveler's diary
 
Angular 2.0
Angular 2.0Angular 2.0
Angular 2.0
 
Brief intro 2 to angular 2
Brief intro 2 to angular 2Brief intro 2 to angular 2
Brief intro 2 to angular 2
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
 
PPT on Angular 2 Development Tutorial
PPT on Angular 2 Development TutorialPPT on Angular 2 Development Tutorial
PPT on Angular 2 Development Tutorial
 
Angular 2 with typescript
Angular 2 with typescriptAngular 2 with typescript
Angular 2 with typescript
 
Get that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronGet that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and Electron
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
An afternoon with angular 2
An afternoon with angular 2An afternoon with angular 2
An afternoon with angular 2
 
Angular 2
Angular 2Angular 2
Angular 2
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 

Similar to AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин

Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 

Similar to AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин (20)

Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners Workshop
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
 
Angular, the New Angular JS
Angular, the New Angular JSAngular, the New Angular JS
Angular, the New Angular JS
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
 
Angular js
Angular jsAngular js
Angular js
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
What is new in visual studio "14"
What is new in visual studio "14"What is new in visual studio "14"
What is new in visual studio "14"
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
OptView2 MUC meetup slides
OptView2 MUC meetup slidesOptView2 MUC meetup slides
OptView2 MUC meetup slides
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
 
Bundle your modules with Webpack
Bundle your modules with WebpackBundle your modules with Webpack
Bundle your modules with Webpack
 
Learn Angular 9/8 In Easy Steps
Learn Angular 9/8 In Easy Steps Learn Angular 9/8 In Easy Steps
Learn Angular 9/8 In Easy Steps
 
Advanced AngularJS Tips and Tricks
Advanced AngularJS Tips and TricksAdvanced AngularJS Tips and Tricks
Advanced AngularJS Tips and Tricks
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
Integrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSIntegrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMS
 
React js Online Training
React js Online TrainingReact js Online Training
React js Online Training
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Recently uploaded (20)

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин