SlideShare a Scribd company logo
Angular 2Angular 2
Le reveil de la forceLe reveil de la force
#BzhCmp #Ng2BzhCmp
BreizhCamp 2015 #BzhCmp
BreizhCamp 2015 #BzhCmp
Nicolas PennecNicolas Pennec
@NicoPennec@NicoPennec
Full-Stack Web Developer
Co-Fondateur de @RennesJS
#Ng2BzhCmp #BzhCmp
BreizhCamp 2015 #BzhCmp
Grégory HoullierGrégory Houllier
@ghoullier@ghoullier
Architecte Web, passionné par le Front-End
Co-Fondateur de @RennesJS
#Ng2BzhCmp #BzhCmp
@RennesJS@RennesJS
rennesjs.orgrennesjs.org
meetup.com/RennesJS/meetup.com/RennesJS/
#Ng2BzhCmp #BzhCmp
Meetup le dernier jeudi de chaque mois
25/06/2015 à Epitech
Angular 1.XAngular 1.X
#Ng2BzhCmp #BzhCmp
Framework JS MV*
Projet open-source porté par Google
Version 1.X très populaire, 1er sur GitHub (39K stars)
Concepts :
Orienté Single Page Application (SPA)
Étendre le langage HTML (directives)
Data Binding bi-directionnel
Dependency Injection, $scope, ...
Annonce d'Angular 2Annonce d'Angular 2
#Ng2BzhCmp #BzhCmp
Octobre 2014:
Première annonce
Rupture de concepts
Pas de rétrocompatibilité
Nouveau langage (AtScript)
Annonce d'Angular 2Annonce d'Angular 2
#Ng2BzhCmp #BzhCmp
Mars 2015
Rétropédalage de Google
Opération séduction des devs
Roadmap de la branche 1.X
Nouveau langage (TypeScript)
PhilosophiePhilosophie
#Ng2BzhCmp #BzhCmp
Apprendre des erreurs d’Angular 1
2-way data binding, dirty-checking, $scope, ...
Se baser sur les futurs standards du web
WebComponents
ES6 / ES7 / TypeScript*
EverGreen Browsers
Emulation due à la concurrence React et Ember
​Amélioration des performances
ES6, ES7, TypeScriptES6, ES7, TypeScript
#Ng2BzhCmp #BzhCmp
ES5 ES6 ES7 TS
ES5 :
ES6 :
ES7 : draft
TS :
es5.github.io
git.io/es6features
typescriptlang.org
Traceur: github.com/google/traceur-compiler
#Ng2BzhCmp #BzhCmp
Surcouche à ES6/ES7
Créé par Microsoft
Collaboration avec Google
Merge avec AtScript
Actuellement en version 1.5-beta
Exemple TypeScriptExemple TypeScript
#Ng2BzhCmp #BzhCmp
import { Annotation } from 'angular2/angular2';
import { Api as ApiSpeakers } from './api/speakers';
@Annotation({
property: 'value'
})
class Talk {
speakers: Array<String>;
thread: String;
constructor(thread: String, api: ApiSpeakers) {
this.thread = thread;
api.get().then((speakers) => {
this.speakers = speakers;
});
}
}
TS
Production Ready ?Production Ready ?
#Ng2BzhCmp #BzhCmp
NO!NO!
Production Ready ?Production Ready ?
#Ng2BzhCmp #BzhCmp
Version Alpha "Developer Preview"
Solution instable
API changeante
Documentation en cours
Pas de Roadmap
PoC Ready ?PoC Ready ?
#Ng2BzhCmp #BzhCmp
YES!YES!
BreizhCamp 2015
Ce qui va changer ?Ce qui va changer ?
#Ng2BzhCmp #BzhCmp
Angular 1
Controller
Service
Module
$scope
jQlite
Directive
Dependency Injection
Angular 2
Controller
Service
Module
$scope
jQlite
Directive
Dependency Injection (TypeScript)
Component
Classes (ES6)
BreizhCamp 2015 #BzhCmp
Directives/ComponentsDirectives/Components
#Ng2BzhCmp #BzhCmp
Directives
Angular 1.X
Directives
Angular 2.X
Components
Angular 2.X
Etendre le DOM
Encapsule un template
BreizhCamp 2015 #BzhCmp
A quoi ça va ressembler?A quoi ça va ressembler?
#Ng2BzhCmp #BzhCmp
BreizhCamp 2015 #BzhCmp
Bootstrap your codeBootstrap your code
#Ng2BzhCmp #BzhCmp
<!DOCTYPE html>
<html>
<head>
<title>Angular 2 - BreizhCamp</title>
<script src="//github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.90/traceur-runtime.js">
{ bootstrap }
{ MyComponent }
</scrip
<script src="//jspm.io/system@0.16.js"></script>
<script src="//code.angularjs.org/2.0.0-alpha.23/angular2.dev.js"></script>
</head>
<body>
<my-component></my-component>
<script type="module">
import from 'angular2/angular2';
import from 'app/my-component';
bootstrap(MyComponent);
</script>
</body>
</html>
HTML
BreizhCamp 2015 #BzhCmp
Component (1/3)Component (1/3)
#Ng2BzhCmp #BzhCmp
<my-component></my-component>
import {
Component, View
} from 'angular2/angular2';
@Component({
selector: 'my-component'
})
@View({
template:
'<div>Hello, BreizhCamp</div>'
})
export class MyComponent {
}
HTML TS
BreizhCamp 2015 #BzhCmp
Component (2/3)Component (2/3)
#Ng2BzhCmp #BzhCmp
import {
Component, View
} from 'angular2/angular2';
@Component({
selector: 'my-component'
})
@View({
template:
'<div>Hello, {{message}}</div>'
})
export class MyComponent {
constructor() {
this.message = 'BreizhCamp';
}
}
<my-component></my-component>
HTML TS
BreizhCamp 2015 #BzhCmp
Component (3/3)Component (3/3)
#Ng2BzhCmp #BzhCmp
import {
Component, View
} from 'angular2/angular2';
@Component({
selector: 'my-component',
properties: {
message: 'msg'
}
})
@View({
template:
'<div>Hello, {{message}}</div>'
})
export class MyComponent {
}
<my-component msg="BreizhCamp">
</my-component>
HTML TS
BreizhCamp 2015 #BzhCmp
Directive (1/2)Directive (1/2)
#Ng2BzhCmp #BzhCmp
import {
Directive
} from 'angular2/angular2';
@Directive({
selector: '[tooltip]',
properties: {
text: 'tooltip'
},
hostListeners: {
mouseover: 'display()'
}
})
export class Tooltip {
display() {
console.log(this.text);
}
}
<div tooltip="Hello BreizhCamp">
Hover Me!
</div>
HTML TS
BreizhCamp 2015 #BzhCmp
Directive (2/2)Directive (2/2)
#Ng2BzhCmp #BzhCmp
import {
Component, View
} from 'angular2/angular2';
import { Tooltip } from './tooltip';
@Component({
selector: 'my-component',
properties: {
message: 'msg'
}
})
@View({
template:
'<div tooltip="Yo!">Hi, {{message}}</div>',
directives: [Tooltip]
})
export class MyComponent {}
<my-component msg="BreizhCamp">
</my-component>
HTML TS
Templating (1/2)Templating (1/2)
#Ng2BzhCmp #BzhCmp
<div>Hello, {{username}}</div>
<button [model]="message" (click)="hello(message)">
Click Me!!
</button>
<audio-player #player></audio-player>
<button (click)="player.pause()">Pause</button>
Interpolation
Property binding / Event binding
Local variable (référence)
Templating (2/2)Templating (2/2)
#Ng2BzhCmp #BzhCmp
<div *if="user">Hello, {{user.name}}</div>
// Équivalent à
<template if="user">
<div>Hello, {{user.name}}</div>
</template>
<ul *if="list.length">
<li *for="#item of list">
{{item.title}}
</li>
</ul>
Whole template
BreizhCamp 2015 #BzhCmp
Dependency InjectionDependency Injection
#Ng2BzhCmp #BzhCmp
import { MyService } from './my-service';
@Component({
selector: 'my-component',
injectables: [MyService]
})
@View({
templateUrl: '/path/to/my-component.html'
})
class MyComponent {
myService: MyService;
constructor(myService: MyService) {
this.myService = myService;
}
fetchData() {
this.myService.get().then((list) => {
console.log(list);
});
}
}
BreizhCamp 2015 #BzhCmp
Migration 1.X vers 2.X ?Migration 1.X vers 2.X ?
#Ng2BzhCmp #BzhCmp
Pas de rétrocompatibilitéPas de rétrocompatibilité
Mais comment anticiper ces changements?Mais comment anticiper ces changements?
Classes ES6/TS pour la définition des services
Modules ES6 pour structurer son code
Utiliser le ngNewRouter qui est sera disponible en 1.4 1.5
Préférer la syntaxe "controllerAs" et "bindToController" pour
les directives
DocumentationDocumentation
#Ng2BzhCmp #BzhCmp
angular.ioangular.io
RessourcesRessources
#Ng2BzhCmp #BzhCmp
github.com/angular/angulargithub.com/angular/angular
youtube.com/user/ngconfvideosyoutube.com/user/ngconfvideos
angular-tips.comangular-tips.com
tryangular2.comtryangular2.com
egghead.io/technologies/angular2egghead.io/technologies/angular2
victorsavkin.comvictorsavkin.com
github.com/timjacobi/angular2-educationgithub.com/timjacobi/angular2-education
ConclusionConclusion
#Ng2BzhCmp #BzhCmp
Angular 2 c'est comme le prochain Star WarsAngular 2 c'est comme le prochain Star Wars
tout le monde l'attend, maistout le monde l'attend, mais
personne ne sait si ça sera à lapersonne ne sait si ça sera à la
hauteurhauteur
BreizhCamp 2015 #BzhCmp
#Ng2BzhCmp #BzhCmp

More Related Content

PDF
Angular 2: What's New?
PDF
Angular 2... so can I use it now??
PDF
Introduction to Angular for .NET Developers
PDF
Getting Started with Angular 2
PDF
Angular2 with type script
PDF
Adventures with Angular 2
PPTX
Angular 2 - Better or worse
PDF
Angular 2 Crash Course
Angular 2: What's New?
Angular 2... so can I use it now??
Introduction to Angular for .NET Developers
Getting Started with Angular 2
Angular2 with type script
Adventures with Angular 2
Angular 2 - Better or worse
Angular 2 Crash Course

What's hot (20)

PDF
The evolution of Angular 2 @ AngularJS Munich Meetup #5
ODP
Introduction to Angular 2
PDF
Building Universal Applications with Angular 2
PDF
Migrating to Angular 2
PPTX
Migrating an application from Angular 1 to Angular 2
PDF
Angular Advanced Routing
PDF
Angular 2 - The Next Framework
PDF
Introduction to angular 2
PDF
Angular 2 - Core Concepts
PDF
Angular2 with TypeScript
PPTX
Angular1x and Angular 2 for Beginners
PDF
Introduction to Angular 2
PPTX
Angular 1.x vs 2 - In code level
PDF
Quick introduction to Angular 4 for AngularJS 1.5 developers
PDF
Angular2 - getting-ready
PDF
An Intro to Angular 2
PDF
JavaScript - The Universal Platform?
PDF
Commit University - Exploring Angular 2
PDF
Tech Webinar: Angular 2, Introduction to a new framework
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Introduction to Angular 2
Building Universal Applications with Angular 2
Migrating to Angular 2
Migrating an application from Angular 1 to Angular 2
Angular Advanced Routing
Angular 2 - The Next Framework
Introduction to angular 2
Angular 2 - Core Concepts
Angular2 with TypeScript
Angular1x and Angular 2 for Beginners
Introduction to Angular 2
Angular 1.x vs 2 - In code level
Quick introduction to Angular 4 for AngularJS 1.5 developers
Angular2 - getting-ready
An Intro to Angular 2
JavaScript - The Universal Platform?
Commit University - Exploring Angular 2
Tech Webinar: Angular 2, Introduction to a new framework
Ad

More from Nicolas PENNEC (7)

PPTX
45 Tools to Boost Your Front-End
PDF
Ng-Conf 2015 Report : AngularJS 1 & 2
PPTX
Introduction à AngularJS
PPTX
Lancement du RennesJS - le User Group de la communauté JavaScript rennaise.
PPTX
Flex 4.6 et Flash Builder 4.6
PPTX
Nouveautés Flash Platform
PPTX
Présentation de Robotlegs
45 Tools to Boost Your Front-End
Ng-Conf 2015 Report : AngularJS 1 & 2
Introduction à AngularJS
Lancement du RennesJS - le User Group de la communauté JavaScript rennaise.
Flex 4.6 et Flash Builder 4.6
Nouveautés Flash Platform
Présentation de Robotlegs
Ad

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
System and Network Administration Chapter 2
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
AI in Product Development-omnex systems
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
System and Network Administraation Chapter 3
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Digital Strategies for Manufacturing Companies
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Transform Your Business with a Software ERP System
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
CHAPTER 2 - PM Management and IT Context
Nekopoi APK 2025 free lastest update
System and Network Administration Chapter 2
Odoo POS Development Services by CandidRoot Solutions
AI in Product Development-omnex systems
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
ManageIQ - Sprint 268 Review - Slide Deck
Odoo Companies in India – Driving Business Transformation.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
System and Network Administraation Chapter 3
Internet Downloader Manager (IDM) Crack 6.42 Build 41
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Design an Analysis of Algorithms I-SECS-1021-03
Digital Strategies for Manufacturing Companies
Understanding Forklifts - TECH EHS Solution
Transform Your Business with a Software ERP System
Wondershare Filmora 15 Crack With Activation Key [2025
CHAPTER 2 - PM Management and IT Context

Angular 2 : le réveil de la force