SlideShare a Scribd company logo
What’s new in Angular 2?
A COMPARISON BETWEEN NG1.X AND NG2
Alfred Jett Grandeza
Founder, Leangineer @ Lean Consulting
leanconsulting.ph | ajgrandeza.com
Lean Consulting
• Davao based start-up
• Founded: February 2016
• Lean Academy SOON!
• More info:
• leanconsulting.ph
• fb.com/leanconsutling.ph
About Me
•Graduate of Ateneo de Davao, Computer Science 2012
•Over 5 years of software engineering experience, .NET and AngularJS
•Former CTO of T.H.E. Patrons
•Co-founder of Lean Consulting/Lean Academy
•Microsoft Technology Associate (2)
•Member of Davao .NET Community (Davao .NET Users Group, Philippine .NET Users Group)
•I do consulting and freelance work from clients overseas
•Advocate of .NET Technologies
•I LOVE TO LEARN!
Prerequisites & Tools
• Required
• JavaScript
• HTML
• CSS
• Helpful
• OOP concepts
• Visual Studio Community
• https://www.visualstudio.com/
• Visual Studio Code
• https://code.visualstudio.com/
Single Page Application
• SPAs are web apps that load a single HTML page and dynamically that page as the user interacts
• Much of the work happen in the client side
• Usually written in JavaScript
SPA Lifecycle
Angular is…
• Open source, JavaScript based front-end framework
• Used for building client-side applications
• MVW Framework (Model-View-Whatever)
• Mainly maintained by Google
Why use Angular?
• Expressive/Customizable HTML
• Powerful Data Binding
• Modular
• Easy back-end integration
Application Demo
• NG 1.X App
• NG 2 App
Key Features of Angular 1.X
• Directives
• Data binding
• Views
• Controllers
• $scope
• Modules
• Dependency Injection
• Routes
• Services
What is a directive?
• Extends HTML attributes, with the prefix “ng-”
• Teaches HTML new tricks
• There are built-in directives
• ng-app
• ng-view
• You can also create your own custom directives
Data Binding
• Interpolation
• {{name}}
• Event Binding
• ng-click=“onClick()”
• Two-way Binding
• <input ng-model=“name” />
Filters & Pipes
• Filters can be added to filter an array
•Pipes can be used to format a data
Views, Controllers, Scope
•View – UI / Display
•Controllers – Controls the logic, data and flow
•$scope is the “glue” between controller and view or the ViewModel
Modules & DI
• A container for the different parts of your Angular app
• You can package code as reusable modules
• You may inject different modules to your module
• Dependency Injection
• Instantiate a module
• ng-app=“”
• Creating a module
• angular.module(‘demoApp’, [])
Routes
• is used for deep-linking URLs to controllers and views
Services
• Are for organizing and share code across your application
Summary for NG1
Key Features
• Directives
• Data binding
• Views
• Controllers
• $scope
• Modules
• Dependency Injection
• Routes
• Services
Angular 2.0
with TypeScript
Live release: Sept 16, 2016
http://angularjs.blogspot.com/2016/09/angular2-final.html
Why Angular 2?
• Built for speed
• Modern
• Simplified API
• Enhanced Productivity
• Develop Across All Platforms
What is TypeScript?
• Open source programming language
• Developed and maintained by Microsoft
• A superset of JavaScript
• Transpiles to plain JavaScript
• Strongly typed
• Class based / OOP approach
• Learn more:
• http://www.typescriptlang.org/Playground
Setting up
• Download
• https://github.com/angular/quickstart
Angular 2 Key Features
• Components
• Templates
• Directives
• Data Binding & Pipes
• Life-cycle hooks
• Services
• Dependency Injection
• Routes
Anatomy of NG 2
Image grabbed from: https://www.pluralsight.com/courses/angular-2-getting-started
Anatomy of a Component
Image grabbed from: https://www.pluralsight.com/courses/angular-2-getting-started
Components
Image grabbed from: https://www.pluralsight.com/courses/angular-2-getting-started
Components
Import statements
Metadata & Template
Class
Decorator
• A function that adds metadata to a class
• Prefixed with an @
• @Component()
Defining a Template in a Component
• Inline template
•Linked Template
Data Binding
• Coordinates communication between the component’s class and template
• Interpolation
• {{name}}
• Event Binding
• (click)=‘onClick()’
• Two-way Binding
• <input [(ngModel)]=‘name’ />
• Property Binding
• <img [src] = ‘customer.thumbnail’ />
Directive in NG2
• Built-in directives
• *ngIf
• *ngFor
Pipes
• | lowercase
• | currency
• | uppercase
• No more filter 
• You have to create your own pipe
Lifecycle Hooks
• A component has a lifecycle
• Angular offers component lifecycle hooks that give us ability to capture these moments
• In other words, events
• Samples
• OnInit
• OnChanges
• OnDestory
Services
• Services are independent from any components
• To provide shared data, logic across multiple components
• Encapsulate external interactions (i.e. Rest API)
Services
Dependency Injection
• A design pattern to resolve dependencies
Retrieve Data using Http
Returns Observables instead of Promises
What is RxJS?
• RxJS is a javascript library for composing asynchronous & event-based programs by using
observable sequences
• Used within Angular
• More info
• http://reactivex.io/rxjs/
Promises vs Observable
• Promise
• Returns a single value
• Not cancellable
• Observable
• Works with multiple values over time
• Cancellable
• “Retryable”
• Supports map, filter, reduce, etc..
Routing
Summary
• Huge difference between NG1 & NG2, in terms of syntax
• NG2 is simpler in terms of Architecture
• TypeScript makes the job easier
References
•https://angular.io/docs/ts/latest/quickstart.html
•https://www.pluralsight.com/courses/angular-2-getting-started
•https://auth0.com/blog/angular-2-series-part-2-domain-models-and-dependency-injection/
•https://auth0.com/blog/angular-2-series-part-3-using-http/

More Related Content

What's hot (19)

PPTX
Introduction to Android Programming
Raveendra R
 
PPTX
Overview about AngularJS Framework
Camilo Lopes
 
PDF
AngularJS
Hiten Pratap Singh
 
PPTX
AngularJS is awesome
Eusebiu Schipor
 
PDF
Angular.js - JS Camp UKraine 2013
Max Klymyshyn
 
PPTX
Angular js tutorial slides
samhelman
 
PDF
Introduction to AngularJS
Aldo Pizzagalli
 
PDF
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
PPTX
Training On Angular Js
Mahima Radhakrishnan
 
PPT
Angular Seminar-js
Mindfire Solutions
 
PPTX
Angular js PPT
Imtiyaz Ahmad Khan
 
PDF
Angular js
Knoldus Inc.
 
PPTX
AngularJS One Day Workshop
Shyam Seshadri
 
PPTX
Introduction to single page application with angular js
Mindfire Solutions
 
PDF
Angular JS - Develop Responsive Single Page Application
Edureka!
 
PDF
One Weekend With AngularJS
Yashobanta Bai
 
PPTX
AngularJS = Browser applications on steroids
Maurice De Beijer [MVP]
 
PPTX
Kalp Corporate Angular Js Tutorials
Kalp Corporate
 
PPTX
Introduction to Angular JS
Santhosh Kumar Srinivasan
 
Introduction to Android Programming
Raveendra R
 
Overview about AngularJS Framework
Camilo Lopes
 
AngularJS is awesome
Eusebiu Schipor
 
Angular.js - JS Camp UKraine 2013
Max Klymyshyn
 
Angular js tutorial slides
samhelman
 
Introduction to AngularJS
Aldo Pizzagalli
 
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
Training On Angular Js
Mahima Radhakrishnan
 
Angular Seminar-js
Mindfire Solutions
 
Angular js PPT
Imtiyaz Ahmad Khan
 
Angular js
Knoldus Inc.
 
AngularJS One Day Workshop
Shyam Seshadri
 
Introduction to single page application with angular js
Mindfire Solutions
 
Angular JS - Develop Responsive Single Page Application
Edureka!
 
One Weekend With AngularJS
Yashobanta Bai
 
AngularJS = Browser applications on steroids
Maurice De Beijer [MVP]
 
Kalp Corporate Angular Js Tutorials
Kalp Corporate
 
Introduction to Angular JS
Santhosh Kumar Srinivasan
 

Viewers also liked (9)

PPTX
Introduction to AngularJS
Collaboration Technologies
 
PPTX
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control - W...
Maarten Balliauw
 
PPTX
Introduction to HTML4
Collaboration Technologies
 
PPTX
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control
Maarten Balliauw
 
PPTX
REST and ASP.NET Web API (Milan)
Jef Claes
 
PPTX
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control
Maarten Balliauw
 
PPTX
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
Stuart
 
PDF
29 Essential AngularJS Interview Questions
Arc & Codementor
 
PPTX
Javaoop
javaexpert
 
Introduction to AngularJS
Collaboration Technologies
 
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control - W...
Maarten Balliauw
 
Introduction to HTML4
Collaboration Technologies
 
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control
Maarten Balliauw
 
REST and ASP.NET Web API (Milan)
Jef Claes
 
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control
Maarten Balliauw
 
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
Stuart
 
29 Essential AngularJS Interview Questions
Arc & Codementor
 
Javaoop
javaexpert
 
Ad

Similar to What's new in Angular 2? (20)

PDF
Angular Live training basic to Advance
Dot Net Tricks
 
PDF
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
Shailendra Chauhan
 
PPTX
Unlimited training using Angular p_p_t
NeelaSaiKiran
 
PPTX
unlimited-angular-training-online-angular-tutorial-learn-angular-2-to-10.pptx
ssuser98f96f
 
PDF
Mastering angular - Dot Net Tricks
Gaurav Singh
 
PPTX
Module2
Hoàng Lê
 
PPTX
Angular js firebase-preso
Avinash Kondagunta
 
PPTX
Introduction to AngularJs
murtazahaveliwala
 
PPTX
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
PDF
Angular2
SitaPrajapati
 
PPTX
Angular js 2
Ran Wahle
 
PPTX
AngularJs (1.x) Presentation
Raghubir Singh
 
PPT
Angularjs for kolkata drupal meetup
Goutam Dey
 
PDF
Angular js
Janu Jahnavi
 
PDF
Angular js
Janu Jahnavi
 
PPTX
Angular js Online Training
Learntek1
 
PPTX
Angularjs Basics
Jayantha Sirisena
 
PPTX
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
PDF
Angular2 with type script
Ravi Mone
 
Angular Live training basic to Advance
Dot Net Tricks
 
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
Shailendra Chauhan
 
Unlimited training using Angular p_p_t
NeelaSaiKiran
 
unlimited-angular-training-online-angular-tutorial-learn-angular-2-to-10.pptx
ssuser98f96f
 
Mastering angular - Dot Net Tricks
Gaurav Singh
 
Module2
Hoàng Lê
 
Angular js firebase-preso
Avinash Kondagunta
 
Introduction to AngularJs
murtazahaveliwala
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
Angular2
SitaPrajapati
 
Angular js 2
Ran Wahle
 
AngularJs (1.x) Presentation
Raghubir Singh
 
Angularjs for kolkata drupal meetup
Goutam Dey
 
Angular js
Janu Jahnavi
 
Angular js
Janu Jahnavi
 
Angular js Online Training
Learntek1
 
Angularjs Basics
Jayantha Sirisena
 
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
Angular2 with type script
Ravi Mone
 
Ad

More from Alfred Jett Grandeza (7)

PPTX
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
 
PPTX
What’s new in VS 2017?
Alfred Jett Grandeza
 
PPTX
Software Engineering - Trends & Industry Practices
Alfred Jett Grandeza
 
PPTX
Career Options for CS/IT/IS graduates
Alfred Jett Grandeza
 
PPTX
Software development fundamentals
Alfred Jett Grandeza
 
PPTX
Introducing MS VS LightSwitch 2011
Alfred Jett Grandeza
 
PPT
Using xml in a data set (ado.net)
Alfred Jett Grandeza
 
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
 
What’s new in VS 2017?
Alfred Jett Grandeza
 
Software Engineering - Trends & Industry Practices
Alfred Jett Grandeza
 
Career Options for CS/IT/IS graduates
Alfred Jett Grandeza
 
Software development fundamentals
Alfred Jett Grandeza
 
Introducing MS VS LightSwitch 2011
Alfred Jett Grandeza
 
Using xml in a data set (ado.net)
Alfred Jett Grandeza
 

Recently uploaded (20)

PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 

What's new in Angular 2?