SlideShare a Scribd company logo
Angular 2 - a New Hope
Angular 2 - a New Hope
Angular 2
Sami Suo-Heikki
19.5.2016
What is Angular 2?
What is Angular 2?
JavaScript Framework
Cross platform
Fully component based
Built from the ground up with TypeScript
Native ES6 modules
Supports server-side prerendering
One framework.
Mobile and Desktop.
Angular 2 - a New Hope
Agenda for today
Architecture of Angular 2 app
Build your application with Angular CLI
Comparison to other JS frameworks
Useful tools
Architecture of Angular 2 app
Component
Binding
Service
Router
Directive
Component
Encapsulate the template,
data and the behaviour of a
view.
Component
import { Component } from '@angular/core';
@Component({
selector: 'hello-world',
template: 'Hello {{name}}!'
})
export class HelloWorldComponent {
constructor() {
this.name = 'World!';
}
}
Component
import { Component } from '@angular/core';
@Component({
selector: 'hello-world',
template: 'Hello {{name}}!'
})
export class HelloWorldComponent {
constructor() {
this.name = 'World!';
}
}
Component
import { Component } from '@angular/core';
@Component({
selector: 'hello-world',
template: 'Hello {{name}}!'
})
export class HelloWorldComponent {
constructor() {
this.name = 'World!';
}
}
Component
import { Component } from '@angular/core';
@Component({
selector: 'hello-world',
template: 'Hello {{name}}!'
})
export class HelloWorldComponent {
constructor() {
this.name = 'World!';
}
}
Component
Component Dom
Binding
Component Dom
name = “World” <h1> {{name}} </h1>
Binding
Component Dom
onClick() {
...
}
<input (click)=”onClick()”>
Two-way data binding
<input [(value)]="todo.text">
Service
Reusable data service in your
application.
Service
Data Access
Logging
Business Logic
Configuration
Router
Responsible for navigation.
Router
@Routes([
{path: '/my-route', component: MyRouteComponent},
{path: '/my-other-route', component: MyOtherComponent},
])
Router
@Routes([
{path: '/my-route', component: MyRouteComponent},
{path: '/my-other-route', component: MyOtherComponent},
])
Router
@Routes([
{path: '/my-route', component: MyRouteComponent},
{path: '/my-other-route', component: MyOtherComponent},
])
Directive
Modify DOM elements and/or
extend their behaviour.
@Component({
selector: 'my-app',
template: `
<vaadin-pie-chart>
…
</vaadin-pie-chart>
`
})
@Component({
selector: 'my-app',
template: `
<vaadin-pie-chart>
…
</vaadin-pie-chart>
`,
directives: [VaadinCharts,
DataSeries]
})
@Component({
selector: 'my-app',
template: `
<vaadin-pie-chart>
…
</vaadin-pie-chart>
`,
directives: [VaadinCharts,
DataSeries]
})
Build your app
with Angular CLI
cli.angular.io
Angular CLI
1. npm install -g angular-cli
2. ng new PROJECT_NAME
3. ng serve
4. ng generate route my-hero
5. ng build
(Demo with Angular CLI)
Comparison to other frameworks
vs
Simplicity
Simplicity
Simplicity
Simplicity
Functionality
Simplicity
Functionality
Simplicity
Functionality
Simplicity
Functionality
Convenience
Simplicity
Functionality
Convenience
Simplicity
Functionality
Convenience
vs
Simplicity
Functionality
Convenience
Simplicity
Functionality
Convenience
Simplicity
Functionality
Convenience
Simplicity
Functionality
Convenience
Useful tools
augury.angular.io
angular.io/styleguide
cli.angular.io
mobile.angular.io
May the
be with you

More Related Content

What's hot (20)

PDF
The productive developer guide to Angular 2
Maurice De Beijer [MVP]
 
PPTX
Angular 2
Nigam Goyal
 
PPTX
Angular 5
Bartłomiej Narożnik
 
PDF
Introduction To Angular 4 - J2I
Nader Debbabi
 
PPTX
Angular 4 - quick view
Michael Haberman
 
PDF
Angular 4 for Java Developers
Yakov Fain
 
PDF
AngularJS 2.0 Jumpstart
Filipe Falcão
 
PDF
Introduction to Angular 2
Naveen Pete
 
PPTX
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
PDF
Angular 2 - An Introduction
NexThoughts Technologies
 
PPTX
Code migration from Angular 1.x to Angular 2.0
Ran Wahle
 
PPTX
Introduction to angular 2
Dor Moshe
 
PDF
Data Flow Patterns in Angular 2 - Sebastian Müller
Sebastian Holstein
 
PPTX
Migrating an Application from Angular 1 to Angular 2
Ross Dederer
 
PPTX
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
PPTX
AngularJS2 / TypeScript / CLI
Domenico Rutigliano
 
PDF
Angular Dependency Injection
Nir Kaufman
 
PDF
Tech Webinar: Angular 2, Introduction to a new framework
Codemotion
 
PDF
Angular2 with type script
Ravi Mone
 
The productive developer guide to Angular 2
Maurice De Beijer [MVP]
 
Angular 2
Nigam Goyal
 
Introduction To Angular 4 - J2I
Nader Debbabi
 
Angular 4 - quick view
Michael Haberman
 
Angular 4 for Java Developers
Yakov Fain
 
AngularJS 2.0 Jumpstart
Filipe Falcão
 
Introduction to Angular 2
Naveen Pete
 
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
Angular 2 - An Introduction
NexThoughts Technologies
 
Code migration from Angular 1.x to Angular 2.0
Ran Wahle
 
Introduction to angular 2
Dor Moshe
 
Data Flow Patterns in Angular 2 - Sebastian Müller
Sebastian Holstein
 
Migrating an Application from Angular 1 to Angular 2
Ross Dederer
 
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
AngularJS2 / TypeScript / CLI
Domenico Rutigliano
 
Angular Dependency Injection
Nir Kaufman
 
Tech Webinar: Angular 2, Introduction to a new framework
Codemotion
 
Angular2 with type script
Ravi Mone
 

Viewers also liked (20)

PPTX
How to build a web application with Polymer
Sami Suo-Heikki
 
PDF
Angular 2 - Core Concepts
Fabio Biondi
 
PPTX
Angular2 for Beginners
Oswald Campesato
 
PDF
Tech talk polymer
Yanuar W
 
PDF
WebApps com Web Components
Beto Muniz
 
PDF
Polymer Elements: Tudo que você precisa saber para criar a web
Beto Muniz
 
PDF
The Beautiful Simplicity of ES2015
Brandon Belvin
 
PDF
O futuro do Android
Erisvaldo Junior
 
PPTX
Material design
David Tiago Conceição
 
PDF
Workshop de Web Components
Guilherme Ventura
 
PDF
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
Horacio Gonzalez
 
PDF
Um salve para evolução! construindo uma nova web com polymer
Marcus Silva
 
PDF
Apresentação Google I/O Extended Vitória
Fabiano Monte
 
PDF
Angular js gtg-27feb2013
Nitya Narasimhan
 
PPTX
Material Design - do smartphone ao desktop
Hillary Sousa
 
PDF
Web components
Evaldo Barbosa
 
PDF
Chrome Dev Summit Highlights (NYC GDG Dec 2013)
Nitya Narasimhan
 
PDF
Polymer and Firebase: Componentizing the Web in Realtime
Juarez Filho
 
PDF
Polymer Starter Kit
Evaldo Barbosa
 
PDF
Introduction To Dart (GDG NY Jan 2014 Meetup)
Nitya Narasimhan
 
How to build a web application with Polymer
Sami Suo-Heikki
 
Angular 2 - Core Concepts
Fabio Biondi
 
Angular2 for Beginners
Oswald Campesato
 
Tech talk polymer
Yanuar W
 
WebApps com Web Components
Beto Muniz
 
Polymer Elements: Tudo que você precisa saber para criar a web
Beto Muniz
 
The Beautiful Simplicity of ES2015
Brandon Belvin
 
O futuro do Android
Erisvaldo Junior
 
Material design
David Tiago Conceição
 
Workshop de Web Components
Guilherme Ventura
 
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
Horacio Gonzalez
 
Um salve para evolução! construindo uma nova web com polymer
Marcus Silva
 
Apresentação Google I/O Extended Vitória
Fabiano Monte
 
Angular js gtg-27feb2013
Nitya Narasimhan
 
Material Design - do smartphone ao desktop
Hillary Sousa
 
Web components
Evaldo Barbosa
 
Chrome Dev Summit Highlights (NYC GDG Dec 2013)
Nitya Narasimhan
 
Polymer and Firebase: Componentizing the Web in Realtime
Juarez Filho
 
Polymer Starter Kit
Evaldo Barbosa
 
Introduction To Dart (GDG NY Jan 2014 Meetup)
Nitya Narasimhan
 
Ad

Similar to Angular 2 - a New Hope (20)

PDF
Angular 2 - The Next Framework
Commit University
 
PDF
はじめてのAngular2
Kenichi Kanai
 
PDF
Commit University - Exploring Angular 2
Commit University
 
PDF
Angular 2 for Java Developers
Yakov Fain
 
PPTX
Angular 2 Migration - JHipster Meetup 6
William Marques
 
PPTX
Angular 2.0
Mallikarjuna G D
 
PPTX
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
PPTX
Angular 2
alinabiliashevych
 
PPTX
Angular 2 in-1
GlobalLogic Ukraine
 
PDF
ChtiJUG - Introduction à Angular2
Demey Emmanuel
 
PPTX
Angular IO
Jennifer Estrada
 
PPTX
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
PPTX
Angular%201%20to%20angular%202
Ran Wahle
 
PPTX
mean stack
michaelaaron25322
 
PDF
angular fundamentals.pdf angular fundamentals.pdf
NuttavutThongjor1
 
PPTX
Angular js 2.0 beta
Nagaraju Sangam
 
PDF
Technozaure - Angular2
Demey Emmanuel
 
PDF
Voorhoede - Front-end architecture
Jasper Moelker
 
PDF
Understanding router state in angular 7 passing data through angular router s...
Katy Slemon
 
PDF
Angular 2.0 - What to expect
Allan Marques Baptista
 
Angular 2 - The Next Framework
Commit University
 
はじめてのAngular2
Kenichi Kanai
 
Commit University - Exploring Angular 2
Commit University
 
Angular 2 for Java Developers
Yakov Fain
 
Angular 2 Migration - JHipster Meetup 6
William Marques
 
Angular 2.0
Mallikarjuna G D
 
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
Angular 2 in-1
GlobalLogic Ukraine
 
ChtiJUG - Introduction à Angular2
Demey Emmanuel
 
Angular IO
Jennifer Estrada
 
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Angular%201%20to%20angular%202
Ran Wahle
 
mean stack
michaelaaron25322
 
angular fundamentals.pdf angular fundamentals.pdf
NuttavutThongjor1
 
Angular js 2.0 beta
Nagaraju Sangam
 
Technozaure - Angular2
Demey Emmanuel
 
Voorhoede - Front-end architecture
Jasper Moelker
 
Understanding router state in angular 7 passing data through angular router s...
Katy Slemon
 
Angular 2.0 - What to expect
Allan Marques Baptista
 
Ad

Recently uploaded (20)

PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
The Future of Artificial Intelligence (AI)
Mukul
 

Angular 2 - a New Hope

Editor's Notes

  • #2: Hello and welcome to this tech lunch about Angular 2-. In one mapa couple of weeks ago Jens and Jouni did a small presentation about angular 2 and this is how they portrated it. Being this evil empire that is gathering followers througout the galaxy. But I like to see things differently, and hopefully after this tech lunch so will you. muista että atomissa on valkoinen teema
  • #3: And this is how I see the current situation. There are a lot of different frameworks all around the galaxy fighting for supremacy. And here in the middle we can see this old princess called AngularJs. And she pretty much started this whole fight back in the year 2010. And after that she gotten a lot different rivals, like React and Polymer. But no worries, a new hope has emerged in the galaxy and that is of course Angular 2. (click) Being the new hope and restoring some balance to the internet.
  • #4: So yeah, topic of today is Angular 2 and for those who don’t know me, my name is Sami Suo-Heikki and this is actually my first tech lunch.
  • #5: So to the first question in hand, what is Angular 2? I’m assuming that most of you already know what Angular 2 is and what its used for. But still lets make a small recap about it.
  • #6: Javascript framework: For building awesome and lighting fast applications. Cross platform: Meaning that you can use it to build other stuff than just web apps, but I’ll soon tell you a bit more about that. Fully component based:framework is component based. When you are loading angular 2, you are just loading the core of it. Meaning that you don’t have to load every feature that is has, but only the things that you really need. And also with Angular you easily build your own application to be a component based and that is a best practice. Built from the ground up with TypeScript: meaning Types are a first class construct. Native ES6 modules: -no more endless script tags. -The ES6 module standard has two parts: -Declarative syntax (for importing and exporting) -Programmatic loader API: to configure how modules are loaded and to conditionally load modules Server side prerendering: Just like other JS framework called React, Angular 2 also supports server-side prerendering. This means that you can render the first view of your application in the server-side, meaning that the first view the user sees is loaded with a speed of lighting. And you can easily do this like with Node.js
  • #7: They promote themselves as one framework which can be used for basically creating any application. But that’s kinda marketing bullshit of course. But yeah one framework for mobile and desktop, and when I say mobile and desktop I don’t just mean mobile and desktop sized web applications. But real mobile and desktop applications. Even native mobile applications. But in these cases you need to use a library of your choosing.
  • #8: and when i say one framework for mobile and desktop, I don’t just mean responsive web applications that looks nice on mobile and desktop. But with Angular 2 you can even create desktop and mobile applications. And here couple of examples like Ionic: And how ionic works is that you are working with web views and Ionic gives you tools on bulding UIs that look native on iOS, android and Windows phone. But use web views like you use on the web. But it also gives you the access to all the native features that you propably want like the camera and gps. And another example is NativeScript and they give a renderer that actually uses the native UI elements on Android, ios and windows. So you can build your app using javascript in Angular 2 but having fully native UI. And for desktop applications you can use Electron. and what they give you is a part of chrome for rendering and node for processing in one package. and with it you can get access to all platform APIs like hardware.
  • #10: and these are not all features that are in Angular 2, but due to a limited time, this is what we are going to check out next.
  • #11: Encapsulate the template, data and the behaviour of a view. So it would be more accurate to call it a view component. Every angular 2 app has at least one component which can be called the root component. And inside components can be several other components. It will help breaking up a big application into a smaller and managable components. And these components can be re-used in different places in our app or in a totally different application. A Component controls a patch of screen real estate that we could call a view. We define a Component's application logic - what it does to support the view - inside a class. The class interacts with the view through an API of properties and methods.
  • #12: And now you might be thinking that what do these components look like? They are actually just a plain typescript classes. And it can have properties and methods. And these properties hold the data for the view and the methods implement the behavior of the view. A Component controls a patch of screen real estate that we could call a view. We define a Component's application logic - what it does to support the view - inside a class. The class interacts with the view through an API of properties and methods.
  • #13: And not you might be thinking that what do these components look like? They are actually just a plain typescript classes. And it can have properties and methods. And these properties hold the data for the view and the methods implement the behavior of the view. A Component controls a patch of screen real estate that we could call a view. We define a Component's application logic - what it does to support the view - inside a class. The class interacts with the view through an API of properties and methods.
  • #14: And not you might be thinking that what do these components look like? They are actually just a plain typescript classes. And it can have properties and methods. And these properties hold the data for the view and the methods implement the behavior of the view. A Component controls a patch of screen real estate that we could call a view. We define a Component's application logic - what it does to support the view - inside a class. The class interacts with the view through an API of properties and methods.
  • #15: And not you might be thinking that what do these components look like? They are actually just a plain typescript classes. And it can have properties and methods. And these properties hold the data for the view and the methods implement the behavior of the view. A Component controls a patch of screen real estate that we could call a view. We define a Component's application logic - what it does to support the view - inside a class. The class interacts with the view through an API of properties and methods.
  • #16: And one key thing to realize is that these components are totally decoupled from the DOM. So please, no jQuery in Angular 2 applications. So instead of accessing the dom, we use binding
  • #17: So instead of accessing the dom, we use binding. If we example change the name, the dom element attached to this property would automatically update. So we don’t need a reference for that dom element in order to update it.
  • #18: Similarly to handle an event raised from the dom element like click or keyInput, we can bind it to a method in our component. And decoupling our component from the dom makes our component a unit testable. Because if you just have a class with no references to elements we can easily test it and don’t require the dom.
  • #19: And how to two way data binding is handled in Angular 2? Pretty easy actually. Application’s and user's changes flows both ways, handling both property changes and event binding. Without a framework, we would be responsible for pushing data values into the HTML controls and turning user responses into actions and value updates. Writing such push/pull logic by hand would be hard and a nightmare as any experienced jQuery programmer can confirm.
  • #20: And the next thing is services, which actually not Angular 2 specific thing, but actually just a resuable data service that you can build in between your application and backend service. So a good thing is to delegate everything that is not needed for the view to the service. So a service is just a plain class that can encapsulate different non-ui logic of your application.
  • #21: For example Data access, making http calls, logging, business logic and configurations of your application.
  • #22: And another key player in our Angular 2 application is the router, which suprise suprise responsible for navigation. So it will subscribe to changes in the url and to figure out what component to present to the user.
  • #26: And the last key player in Angular is the Directive. And similary as to components is that we use them to work with the UI. But unlike the component, the directive doesn’t have a template or any HTML itself. It is just for modifying the existing DOM elements. And one example of a directive is what the Elements and the pro team here has built for the Vaadin Elements.