SlideShare a Scribd company logo
Understanding Angular 2
Shmuela Jacobs
MILAN 25-26 NOVEMBER 2016
Shmuela Jacobs
- BSc in Physics, MSc in IM
- Owns a deaf dog 

and a one-eyed cat
- organizer
Developer & Consultant @ 500Tech
ngGirls
ng-girls.org
ANGULAR 2
https://angular.io
https://github.com/angular/angular
• framework platform
• web, mobile web
• native mobile, desktop, 

Arduino...
• cutting edge
• performance, 

productivity, versatility
✓ the language: TypeScript
✓ component architecture
✓ component types
✓ change detection
✓ NgModule
✓ dependency injection
✓ rendering architecture
Understanding
Angular 2
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
JavaScript + Types
TypeScript
ES6
(ES-2015)
JavaScript
(ES5)
• type checking

string, number, boolean, any, Array<T>
• custom types - interfaces
• code help - intellisense
• decorators
• and more...
• ES6 classes
• @decorators
• dependency injection
http://www.typescriptlang.org
Component
Architecture
E-Store
search
4
E-Store
search
4
E-Store
search
4
<header>

<a href="home.html">E-Store</a>

</header>

<aside>

<a href="cart.html">

4 <img src="cart.jpg">

</a>

</aside>

<main>

<div>

<input type="text">

<button>search</button>

</div>

<div id="products">

<ul>

<li>

<a href="product1.html">

<h3>Product Title</h3>

<img src="product.jpg">

</a>

</li>
<li>...</li>

</ul>

</div>

</main>
app
my-storeheader
search-bar product-list
nav-bar
product product product
product x
app
my-storeheader
search-bar product-list
nav-bar
product product product
product x
Component Tree
Component
Template
</>
Controller
{ }
Style {CSS}
Component
Template
</>
Controller
{ }
Directive
{ }
Component
</> + { }
Service
{ }
Style {CSS}
Hi Angular 2!
<h1>
Hi {{ name }}!

</h1>
name =
'Angular 2';
h1 {
color: red
}
Component
Template
</>
Controller
{ }
Directive
{ }
Component
</> + { }
Service
{ }
Style {CSS}
<h1>
Hi {{ name }}!

</h1>
name =
'Angular 2';
h1 {
color: red
}
Pipe
{{ | }}
| uppercase

Hi ANGULAR 2!
Component
import { Component } from '@angular/core';



@Component({

selector: 'app-hello',

template: `

<h1>{{ title }}</h1>`

})



export class HelloComponent {
title = 'Hello World!';
}

<app-hello></app-hello>
Somewhere in your app
Component Types
Stateful components
Stateless components
Routed components
Stateful 

Component
Container Component
Smart Component
app
my-storeheader
search-bar product-list
nav-bar
product product product
Products
Service
product-view
inject
Stateful Component
this.products =
this.productsService.getProducts();
Stateless 

Component
Presentational Component
Dumb Component
app
my-storeheader
search-bar product-list
nav-bar
product product product
product-view
Stateless Components
<app-product-list [productList]="products"
(addToCart)="addProductToCart($event)">
</app-product-list>
( output ) [ input ]
this.products
Products
Service
inject
In my-store template:
Component
import { Component, EventEmitter } from '@angular/core';



@Component({

selector: 'app-product-list',

template: `

<app-product *ngFor="let item of productList"
[product]="item">
</app-product>`

})



export class ProductListComponent {


@Input() productList:string = '';


@Output() addToCart:EventEmitter<any> =
new EventEmitter();
}

Property & Event Binding
<input [value]="defaultInput"
[style]="getInputStyle()"
(keyup.enter)="submit($event)"/>
<button (click)="clickHandler()">
Click Me!
</button>
ngModel
<h1>{{ product.title }}</h1>
<input [(ngModel)]="product.title">
Inputs & Outputs
Hello!
Hello!
Routed 

Component
View Component
E-Store
search
4
https://mystore.com/products
E-Store
search
4
https://mystore.com/product/8
app
my-storeheader
search-bar product-list
nav-bar
product product product
product-view
Routing
<router-outlet></router-outlet>
RouterModule
Change
Detection
Zones
browser events
setTimeout(), setInterval()
Ajax requests
and more...
app
my-storeheader
search-bar products-list
nav-bar
product product product
product x
Change Detection
<input (keyup.enter)="search($event.target.value)">
<app-product-list [list]="searchProductList">
app
my-storeheader
search-bar products-list
nav-bar
product product product
product x
Change Detection
using OnPush
change detection
strategy
product list
changed
using immutable
Objects
<input (keyup.enter)="search($event.target.value)">
<app-product-list [list]="searchProductList">
Angular

Modules
Help organize an application into
cohesive blocks of functionality
AppModule: NgModule
CartModule
app
my-storeheader
search-bar product-list
nav-bar
product
shopping cart
Component Tree
ProductModule
FormModule
shopping cart
service
NgModule
Angular Module
Components
Directives
Pipes
Services
NgModules
NgModule
Angular Module - Feature Module
Components
Directives
Pipes
Services
NgModules
Imports
Components
Directives
Pipes
Declarations
Providers
NgModule
Angular Module - Feature Module
Components
Directives
Pipes
Services
NgModules
Imports
Exports
NgModules
Components
Directives
Pipes
Declarations
Providers
NgModule
Angular Module - Root Module
Components
Directives
Pipes
Services
NgModules
Imports
Components
Directives
Pipes
Declarations
Providers
Bootstrap
appModule: NgModule
CartModule
app
my-storeheader
search-bar product-list
nav-bar
product
shopping cart
Component Tree
ProductModule
FormModule
shopping cart
service
Dependency
Injection
Manages instances of services
and injects the desired instance
to the component
app
my-storeheader
search-bar products-list
nav-bar
product product product
shopping
cart
service
product x
inject
provide
CartModule
Dependency Injection AppModule
import
Rendering
Architecture
Separation of application logic
from the graphical aspects 

of the application
Application
Renderer
Render
Directives
Dependency
Injection
Change
Detection
Elements/
Text
EventsProperties
ANGULAR 2
https://angular.io
https://github.com/angular/angular
• framework platform
• web, mobile web
• native mobile, desktop, 

Arduino...
• cutting edge
• performance, 

productivity, versatility
Shmuela Jacobs
shmuelaj@gmail.com
linkedin.com/in/shmuelaj
github.com/shmool
@ShmuelaJ
ng-girls.org

More Related Content

PDF
Angular 2 - The Next Framework
PDF
Tech Webinar: Angular 2, Introduction to a new framework
PPTX
Angular js 2
ODP
Introduction to Angular 2
PDF
Introduction to Angular 2
PDF
Angular 2 Essential Training
PDF
Angular 2: core concepts
PDF
Exploring Angular 2 - Episode 2
Angular 2 - The Next Framework
Tech Webinar: Angular 2, Introduction to a new framework
Angular js 2
Introduction to Angular 2
Introduction to Angular 2
Angular 2 Essential Training
Angular 2: core concepts
Exploring Angular 2 - Episode 2

What's hot (20)

PDF
Exploring Angular 2 - Episode 1
PPTX
PPTX
Angular1x and Angular 2 for Beginners
PPTX
AngularJS2 / TypeScript / CLI
PDF
Angular2 with TypeScript
PPTX
Async patterns in javascript
PDF
The evolution of Angular 2 @ AngularJS Munich Meetup #5
PDF
Angular2 Development for Java developers
PPTX
Angular2 for Beginners
PDF
Commit University - Exploring Angular 2
PPTX
What’s new in angular 2
PDF
Angular 2: What's New?
PDF
An Intro to Angular 2
PDF
Data Flow Patterns in Angular 2 - Sebastian Müller
PPTX
Introduction to angular 2
PDF
Angular 2 overview
PPTX
Introduction to Angular2
PDF
Overview of the AngularJS framework
PDF
Angular 4 for Java Developers
PDF
The productive developer guide to Angular 2
Exploring Angular 2 - Episode 1
Angular1x and Angular 2 for Beginners
AngularJS2 / TypeScript / CLI
Angular2 with TypeScript
Async patterns in javascript
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Angular2 Development for Java developers
Angular2 for Beginners
Commit University - Exploring Angular 2
What’s new in angular 2
Angular 2: What's New?
An Intro to Angular 2
Data Flow Patterns in Angular 2 - Sebastian Müller
Introduction to angular 2
Angular 2 overview
Introduction to Angular2
Overview of the AngularJS framework
Angular 4 for Java Developers
The productive developer guide to Angular 2
Ad

Viewers also liked (20)

PDF
Come rendere il proprio prodotto una bomba creandogli una intera community in...
PDF
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
PPTX
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
PDF
How To Structure Go Applications - Paul Bellamy - Codemotion Milan 2016
PDF
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
PDF
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
PDF
Games of Simplicity - Pozzi; Molinari - Codemotion Milan 2016
PDF
Lo sviluppo di Edge Guardian VR - Maurizio Tatafiore - Codemotion Milan 2016
PPTX
Master the chaos: from raw data to analytics - Andrea Pompili, Riccardo Rossi...
PDF
Developing apps for developing countries - Natalie Pistunovich - Codemotion M...
PDF
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
PDF
Getting started with go - Florin Patan - Codemotion Milan 2016
PDF
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
PDF
Lo sviluppo di Edge Guardian VR - Marco Giammetti - Codemotion Milan 2016
PDF
Cyber Analysts: who they are, what they do, where they are - Marco Ramilli - ...
PDF
The (almost) lost art of Smalltalk - Nikolas Martens - Codemotion Milan 2016
PDF
The hitchhiker's guide to UXing without a UXer - Chrissy Welsh - Codemotion M...
PDF
The Evolution of Asynchronous Javascript - Alessandro Cinelli - Codemotion Mi...
PDF
A-Frame in the Virtual World, small bricks of virtual reality web - Giovanni ...
PPTX
Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone...
Come rendere il proprio prodotto una bomba creandogli una intera community in...
Milano Chatbots Meetup - Vittorio Banfi - Bot Design - Codemotion Milan 2016
DevOps in Cloud, dai Container all'approccio Codeless - Gabriele Provinciali,...
How To Structure Go Applications - Paul Bellamy - Codemotion Milan 2016
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Games of Simplicity - Pozzi; Molinari - Codemotion Milan 2016
Lo sviluppo di Edge Guardian VR - Maurizio Tatafiore - Codemotion Milan 2016
Master the chaos: from raw data to analytics - Andrea Pompili, Riccardo Rossi...
Developing apps for developing countries - Natalie Pistunovich - Codemotion M...
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Lo sviluppo di Edge Guardian VR - Marco Giammetti - Codemotion Milan 2016
Cyber Analysts: who they are, what they do, where they are - Marco Ramilli - ...
The (almost) lost art of Smalltalk - Nikolas Martens - Codemotion Milan 2016
The hitchhiker's guide to UXing without a UXer - Chrissy Welsh - Codemotion M...
The Evolution of Asynchronous Javascript - Alessandro Cinelli - Codemotion Mi...
A-Frame in the Virtual World, small bricks of virtual reality web - Giovanni ...
Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone...
Ad

Similar to Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016 (20)

PPTX
Moving From AngularJS to Angular 2
PDF
WebNet Conference 2012 - Designing complex applications using html5 and knock...
PPTX
Angular 2 at solutions.hamburg
PPTX
angular-concepts-introduction-slides.pptx
PDF
Angular 2 for Java Developers
PDF
Building an Angular 2 App
PDF
A Gentle Introduction to Angular Schematics - Angular SF 2019
PDF
Angular 2 overview in 60 minutes
PDF
better-apps-angular-2-day1.pdf and home
PDF
はじめてのAngular2
PDF
Crash Course in AngularJS + Ionic (Deep dive)
PPTX
Building a TV show with Angular, Bootstrap, and Web Services
PPTX
Analytics Metrics delivery and ML Feature visualization: Evolution of Data Pl...
PDF
Stencil the time for vanilla web components has arrived
PPTX
Wix Machine Learning - Ran Romano
PPTX
Scala Italy 2015 - Hands On ScalaJS
PPTX
Alberto Paro - Hands on Scala.js
PPTX
mean stack
PDF
Basic overview of Angular
PDF
Hidden Docs in Angular
Moving From AngularJS to Angular 2
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Angular 2 at solutions.hamburg
angular-concepts-introduction-slides.pptx
Angular 2 for Java Developers
Building an Angular 2 App
A Gentle Introduction to Angular Schematics - Angular SF 2019
Angular 2 overview in 60 minutes
better-apps-angular-2-day1.pdf and home
はじめてのAngular2
Crash Course in AngularJS + Ionic (Deep dive)
Building a TV show with Angular, Bootstrap, and Web Services
Analytics Metrics delivery and ML Feature visualization: Evolution of Data Pl...
Stencil the time for vanilla web components has arrived
Wix Machine Learning - Ran Romano
Scala Italy 2015 - Hands On ScalaJS
Alberto Paro - Hands on Scala.js
mean stack
Basic overview of Angular
Hidden Docs in Angular

More from Codemotion (20)

PDF
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
PDF
Pompili - From hero to_zero: The FatalNoise neverending story
PPTX
Pastore - Commodore 65 - La storia
PPTX
Pennisi - Essere Richard Altwasser
PPTX
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
PPTX
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
PPTX
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
PPTX
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
PDF
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
PDF
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
PDF
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
PDF
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
PDF
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
PDF
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
PPTX
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
PPTX
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
PDF
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
PDF
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
PDF
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
PDF
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Pompili - From hero to_zero: The FatalNoise neverending story
Pastore - Commodore 65 - La storia
Pennisi - Essere Richard Altwasser
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
A Presentation on Artificial Intelligence
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectroscopy.pptx food analysis technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Assigned Numbers - 2025 - Bluetooth® Document
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A Presentation on Artificial Intelligence
Network Security Unit 5.pdf for BCA BBA.
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Unlocking AI with Model Context Protocol (MCP)
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016