SlideShare a Scribd company logo
https://www.youtube.com/watch?v=hxuDIvMtGsw&feature=youtu.be&t=412
Domenico Rutigliano WEB SOLUTION ENGINEER
Benefit coming with AngularJS 2
This on the left is a React Coder Face
Expression while reading about
AngularJS 2.0
1. Faster and Modern Browser
2. Mobile Driven
3. More Flexible
4. Better Performance
5. Easier Implementation
6. Simplified Dependency Injection
7. Stronger Routing
8. Command Line Interface !!!!!!
Angular 2 is entirely component based. Controllers and $scope are no longer used. They have
been replaced by components and directives. Components are directives with a template.
AngularJS 2 CLI
AngularJS 2 uses TypeScript
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
1. Starts and ends with JavaScripts
2. Strong tools for large Apps
3. State of the art JavaScript
TypeScript offers support for the latest and evolving JavaScript
features, including those from ECMAScript 2015 and future
proposals, like async functions and decorators, to help build
robust components.
TypeScript Magic : ECMAScript GAP Sorted out.
We can write TS which uses latest features of ES then downgrade to most diffuse
version on production that is actually supported by any OS/Browser/Device so we
can get the advantages of latest features which simplify coders life and then
downgrade to any version of ES we need.
AngularJS 2 First App
$ ng new ng-Squiz
I can see in my terminal the magic happening.
For the sake of demonstrate the potential of
AngularJS 2 I am going to create a simple app
which Create a Task List.
AngularJS 2 Task List App
$ ng serve
We will quickly get our app running in the
browser.
Now to meet the requirement of my Task List
App I need:
1. A TaskList class to represent individual
Task
2. A TaskList service to create update and
remove Tasks
3. A TaskApp Component to display the
user interface
AngularJS 2 Task List App
$ ng generate class TaskList
I installed into my IDE (Netbeans) the Type
Script Editor Plugin. I then created a project
based on the already existing source code
generated by Angular CLI.
I opened the task-list.ts and started inserting
the properties I want to define for each Task:
id: number, unique ID of the todo item
title: string, title of the todo item
complete: boolean, whether or not the task is
complete
AngularJS 2 Task List App
Unit Test
Angular CLI by default generates a
src/app/task-list.spec.ts for us! Let’s add a unit
test to make sure the constructor logic works
as expected
$ ng test
To verify whether our code works as expected,
I executed ng test which is going to run the unit
Test
AngularJS 2 Task List App
$ ng generate service TaskList
We can now add our task management logic to
our TaskListService in src/app/task-
list.service.ts
The actual implementation details of the
methods are not essential for the purpose of
this presentation. The main takeaway is that
we centralize the business logic in a
service.
I collapsed some nodes to fit everything in
a screenshot.
A repository of the original source code is
available on this link
AngularJS 2 Task List App
$ ng test
To make sure our logic works as expected, let’s
add unit tests to src/app/todo.service.spec.ts
which was already generated by Angular CLI.
Because Angular CLI already generates the
boilerplate code for us, we only have to worry
about implementing the tests.
AngularJS 2 Task List App
$ ng generate component TaskListApp
Template and styles can also be specified
inline inside the script file. Angular CLI creates
separate files by default. I do not really love to
include Markup code into the script file so I will
keep the same configuration.
AngularJS 2 Task List App
Telling Angular to run our new component
In index.html you also need to change
<app-root>Awesomness is coming...</app-root>
To <task-list-app>Awesomness is coming...</task-list-app>
And main.ts needs to be changed to:
import { bootstrap } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import {environment} from './app/';
import { TaskListComponent } from './app/task-list-app';
if (environment.production) {
enableProdMode();
}
bootstrap(TodoAppComponent);
THANKS FOR ATTENDING THIS SFM
https://gitlab.squiz.net/drutigliano/AngularJS2APP

More Related Content

PPTX
Async patterns in javascript
Ran Wahle
 
PPTX
Angular js 2
Ran Wahle
 
PDF
Angular 2: core concepts
Codemotion
 
PDF
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Johannes Weber
 
PDF
Introduction to Angular 2
Naveen Pete
 
PDF
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
PDF
Angular2 with TypeScript
Rohit Bishnoi
 
PDF
Angular 2 - The Next Framework
Commit University
 
Async patterns in javascript
Ran Wahle
 
Angular js 2
Ran Wahle
 
Angular 2: core concepts
Codemotion
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Johannes Weber
 
Introduction to Angular 2
Naveen Pete
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
Angular2 with TypeScript
Rohit Bishnoi
 
Angular 2 - The Next Framework
Commit University
 

What's hot (20)

ODP
Introduction to Angular 2
Knoldus Inc.
 
PDF
Tech Webinar: Angular 2, Introduction to a new framework
Codemotion
 
PDF
The productive developer guide to Angular 2
Maurice De Beijer [MVP]
 
PDF
Angular2 - In Action
Sebastian Pożoga
 
PPTX
Introduction to angular 2
Dor Moshe
 
PPTX
Angular 4 Introduction Tutorial
Scott Lee
 
PDF
Angular 2 Essential Training
Patrick Schroeder
 
PPTX
Angular 2
Nigam Goyal
 
PDF
Data Flow Patterns in Angular 2 - Sebastian Müller
Sebastian Holstein
 
PPTX
Angular 5
Bartłomiej Narożnik
 
PDF
Angular Dependency Injection
Nir Kaufman
 
PDF
Angular 2 - An Introduction
NexThoughts Technologies
 
PPTX
What’s new in angular 2
Ran Wahle
 
PPTX
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
PDF
Angular2 with type script
Ravi Mone
 
PDF
Building Universal Applications with Angular 2
Minko Gechev
 
PDF
Angular 2: What's New?
jbandi
 
PDF
Commit University - Exploring Angular 2
Commit University
 
PPTX
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
PPTX
Angular 2.0: Getting ready
Axilis
 
Introduction to Angular 2
Knoldus Inc.
 
Tech Webinar: Angular 2, Introduction to a new framework
Codemotion
 
The productive developer guide to Angular 2
Maurice De Beijer [MVP]
 
Angular2 - In Action
Sebastian Pożoga
 
Introduction to angular 2
Dor Moshe
 
Angular 4 Introduction Tutorial
Scott Lee
 
Angular 2 Essential Training
Patrick Schroeder
 
Angular 2
Nigam Goyal
 
Data Flow Patterns in Angular 2 - Sebastian Müller
Sebastian Holstein
 
Angular Dependency Injection
Nir Kaufman
 
Angular 2 - An Introduction
NexThoughts Technologies
 
What’s new in angular 2
Ran Wahle
 
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
Angular2 with type script
Ravi Mone
 
Building Universal Applications with Angular 2
Minko Gechev
 
Angular 2: What's New?
jbandi
 
Commit University - Exploring Angular 2
Commit University
 
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Angular 2.0: Getting ready
Axilis
 
Ad

Viewers also liked (11)

PDF
Cassandra Day Atlanta 2015: Feeding Solr at Large Scale with Apache Cassandra
DataStax Academy
 
PDF
Angular js
Knoldus Inc.
 
ODP
Intro to cassandra
Aaron Ploetz
 
PDF
Angular Weekend
Troy Miles
 
PDF
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
DataStax
 
PDF
Angular 2 for Java Developers
Yakov Fain
 
PDF
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
PDF
AngularJS Basics with Example
Sergey Bolshchikov
 
PPTX
AngularJS2
Carlos Uscamayta
 
PDF
Getting Started with Angular 2
FITC
 
PDF
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Anton Kirillov
 
Cassandra Day Atlanta 2015: Feeding Solr at Large Scale with Apache Cassandra
DataStax Academy
 
Angular js
Knoldus Inc.
 
Intro to cassandra
Aaron Ploetz
 
Angular Weekend
Troy Miles
 
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
DataStax
 
Angular 2 for Java Developers
Yakov Fain
 
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
AngularJS Basics with Example
Sergey Bolshchikov
 
AngularJS2
Carlos Uscamayta
 
Getting Started with Angular 2
FITC
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Anton Kirillov
 
Ad

Similar to AngularJS2 / TypeScript / CLI (20)

PPTX
Angular kickstart slideshare
SaleemMalik52
 
PDF
Ng talk
Aymene Bennour
 
DOCX
Angular js getting started
Hemant Mali
 
PDF
Angular 2 Crash Course
Elisha Kramer
 
PPTX
Angular
TejinderMakkar
 
DOCX
ANGULAR JS LAB MANUAL(final) vtu2021 sch
kannikadg
 
PPTX
Angular
sridhiya
 
PPTX
mobile development using node js and java
vishal choudhary
 
PDF
One Weekend With AngularJS
Yashobanta Bai
 
PDF
Angular Interview Questions-PDF.pdf
JohnLeo57
 
PPTX
Angular 9
Raja Vishnu
 
PPTX
Angular%201%20to%20angular%202
Ran Wahle
 
PPTX
Start your journey with angular | Basic Angular
Anwarul Islam
 
PPTX
Ng2 cli
Abbas Zahir
 
PPTX
UQ21CA642BA1-Unit-3-WAF-Class18-Introduction to Angular Routing.pptx
TamalDey28
 
PPTX
Angular 2.0
Mallikarjuna G D
 
PPTX
Intoduction to Angularjs
Gaurav Agrawal
 
PPTX
Angularjs2 presentation
dharisk
 
PDF
AngularJS Basics
Ravi Mone
 
PDF
AngularJS 101
Houssem Yahiaoui
 
Angular kickstart slideshare
SaleemMalik52
 
Angular js getting started
Hemant Mali
 
Angular 2 Crash Course
Elisha Kramer
 
ANGULAR JS LAB MANUAL(final) vtu2021 sch
kannikadg
 
Angular
sridhiya
 
mobile development using node js and java
vishal choudhary
 
One Weekend With AngularJS
Yashobanta Bai
 
Angular Interview Questions-PDF.pdf
JohnLeo57
 
Angular 9
Raja Vishnu
 
Angular%201%20to%20angular%202
Ran Wahle
 
Start your journey with angular | Basic Angular
Anwarul Islam
 
Ng2 cli
Abbas Zahir
 
UQ21CA642BA1-Unit-3-WAF-Class18-Introduction to Angular Routing.pptx
TamalDey28
 
Angular 2.0
Mallikarjuna G D
 
Intoduction to Angularjs
Gaurav Agrawal
 
Angularjs2 presentation
dharisk
 
AngularJS Basics
Ravi Mone
 
AngularJS 101
Houssem Yahiaoui
 

Recently uploaded (20)

PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PPTX
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PDF
Become an Agentblazer Champion Challenge
Dele Amefo
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
PPTX
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PPTX
Presentation about variables and constant.pptx
safalsingh810
 
PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
oapresentation.pptx
mehatdhavalrajubhai
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
Become an Agentblazer Champion Challenge
Dele Amefo
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
Presentation about variables and constant.pptx
safalsingh810
 
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 

AngularJS2 / TypeScript / CLI

  • 2. Benefit coming with AngularJS 2 This on the left is a React Coder Face Expression while reading about AngularJS 2.0 1. Faster and Modern Browser 2. Mobile Driven 3. More Flexible 4. Better Performance 5. Easier Implementation 6. Simplified Dependency Injection 7. Stronger Routing 8. Command Line Interface !!!!!! Angular 2 is entirely component based. Controllers and $scope are no longer used. They have been replaced by components and directives. Components are directives with a template.
  • 4. AngularJS 2 uses TypeScript TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. 1. Starts and ends with JavaScripts 2. Strong tools for large Apps 3. State of the art JavaScript TypeScript offers support for the latest and evolving JavaScript features, including those from ECMAScript 2015 and future proposals, like async functions and decorators, to help build robust components.
  • 5. TypeScript Magic : ECMAScript GAP Sorted out. We can write TS which uses latest features of ES then downgrade to most diffuse version on production that is actually supported by any OS/Browser/Device so we can get the advantages of latest features which simplify coders life and then downgrade to any version of ES we need.
  • 6. AngularJS 2 First App $ ng new ng-Squiz I can see in my terminal the magic happening. For the sake of demonstrate the potential of AngularJS 2 I am going to create a simple app which Create a Task List.
  • 7. AngularJS 2 Task List App $ ng serve We will quickly get our app running in the browser. Now to meet the requirement of my Task List App I need: 1. A TaskList class to represent individual Task 2. A TaskList service to create update and remove Tasks 3. A TaskApp Component to display the user interface
  • 8. AngularJS 2 Task List App $ ng generate class TaskList I installed into my IDE (Netbeans) the Type Script Editor Plugin. I then created a project based on the already existing source code generated by Angular CLI. I opened the task-list.ts and started inserting the properties I want to define for each Task: id: number, unique ID of the todo item title: string, title of the todo item complete: boolean, whether or not the task is complete
  • 9. AngularJS 2 Task List App Unit Test Angular CLI by default generates a src/app/task-list.spec.ts for us! Let’s add a unit test to make sure the constructor logic works as expected $ ng test To verify whether our code works as expected, I executed ng test which is going to run the unit Test
  • 10. AngularJS 2 Task List App $ ng generate service TaskList We can now add our task management logic to our TaskListService in src/app/task- list.service.ts The actual implementation details of the methods are not essential for the purpose of this presentation. The main takeaway is that we centralize the business logic in a service. I collapsed some nodes to fit everything in a screenshot. A repository of the original source code is available on this link
  • 11. AngularJS 2 Task List App $ ng test To make sure our logic works as expected, let’s add unit tests to src/app/todo.service.spec.ts which was already generated by Angular CLI. Because Angular CLI already generates the boilerplate code for us, we only have to worry about implementing the tests.
  • 12. AngularJS 2 Task List App $ ng generate component TaskListApp Template and styles can also be specified inline inside the script file. Angular CLI creates separate files by default. I do not really love to include Markup code into the script file so I will keep the same configuration.
  • 13. AngularJS 2 Task List App Telling Angular to run our new component In index.html you also need to change <app-root>Awesomness is coming...</app-root> To <task-list-app>Awesomness is coming...</task-list-app> And main.ts needs to be changed to: import { bootstrap } from '@angular/platform-browser-dynamic'; import { enableProdMode } from '@angular/core'; import {environment} from './app/'; import { TaskListComponent } from './app/task-list-app'; if (environment.production) { enableProdMode(); } bootstrap(TodoAppComponent);
  • 14. THANKS FOR ATTENDING THIS SFM https://gitlab.squiz.net/drutigliano/AngularJS2APP