SlideShare a Scribd company logo
Angular 4
Quick introduction for AngularJS 1.5 developers
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
Angular 4
Quick introduction for AngularJS 1.5 developers
a.k.a.
How to not write a large or scalable web applications.
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
Angular 4
Quick introduction for AngularJS 1.5 developers
a.k.a.
How to not write a large or scalable web applications.
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
Angular 4
Quick introduction for AngularJS 1.5 developers
a.k.a.
How to not write a large or scalable web applications.
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
Agenda
• @AboutMe()
• Javascript ecosystem (prepare the environment during this part)
• Trends
• Modules
• Javascript fatigue
• Workshop
• Boilerplate
• Blueprints
• Typescript/Angular
• Building blocks – service, component, dependency injection
• Q&A
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
@AboutMe()
• I started programming 18 years ago
• I code for money from the 9 years
• I code for Decerto 3 years
• I was programming in Pascal, C, PHP, Javascript, Bash, SQL, C++, Java, Typescript
• I did some AJAX before it was popular
• I did some UX before it was so popular
• I did some Devops before it was so named
• I was programming SPAs over the last 4 years in AngularJS
• I observe the development of Angular 2 since AngularJS 1.5-beta.0
• I am doing SPA in Angular 2 the last few months
• I switch to Angular 4 in the coming weeks
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
@AboutMe()
• I started programming 18 years ago
• I code for money from the 9 years
• I code for Decerto 3 years
• I was programming in Pascal, C, PHP, Javascript, Bash, SQL, C++, Java, Typescript
• I did some AJAX before it was popular
• I did some UX before it was so popular
• I did some Devops before it was so named
• I was programming SPAs over the last 4 years in AngularJS
• I observe the development of Angular 2 since AngularJS 1.5-beta.0
• I am doing SPA in Angular 2 the last few months
• I switch to Angular 4 in the coming weeks
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23
Workshop (It is the time to prepare environment)
• You should have installed:
• node >= 6.9.0 (https://nodejs.org/  download and install LTS)
• npm >= 3.0.0 (bundled with node)
• git
• bash (winbash, gitbash, zsh)
• typescript aware IDE
• Intellij Idea Ultimate / Intellij Idea Ultimate EAP
• Microsoft Visual Studio Code
• Microsoft Visual Studio
• Atom
• Your favorite
Task 0 – Hello world
Task 0 – Hello world
• npm install --global @angular/cli@latest # first time only
• ng new --ng4 my-project # first time only
# Let scripts do the work…
Trends
Trends trends
Trends trends trends
Trends trends trends trends
Trends trends trends trends trends
Trends trends trends trends trends trends
Trends…
• Trends proves (almost) every thesis
• angular and react in game
• It’s hard to say which is better
• Angularjs migrates to Angular
• Jquery still popular but it is going down
Task 0 – Hello world (remind)
• npm install --global @angular/cli@latest # first time only
• ng new --ng4 my-project # first time only
# Let scripts do the work…
There are frameworks
• Angular
• AngularJS
• Aurelia
• Backbone
• CycleJs
• Elm
• EmberJs
• ExtJs
• Knockout
• Meteor
• Mithril
• Polymer
• Preact
• React
• VueJs
There are packages managers
• Bower
• Npm
• (WebJars)
• Yarn
(modules without Javascript ecosystem)
(modules without Javascript ecosystem)
Task 0 – Hello world (remind)
• npm install --global @angular/cli@latest # first time only
• ng new --ng4 my-project # first time only
# Let scripts do the work…
There are languages
• ClojureScript
• CofeeScript
• Dart
• Ecmascript 5
• Ecmascript 2015
• Ecmasrcipt 2016
• Elm
• Typescript
There are compilers/transpilers
• Babel
• Clojure
• CoffeScript
• Dart
• Elm
• Emscripten
• Google Closure Compiler
• Typescript
There are static analyzis tools
• Codelyzer
• JSHint
• JSLint
• TSLint
There are template engines
• HandleBars
• Jade
• JSX
There are unit test frameworks
• Ava
• Chai
• Jasmine
• Mocha
• Qunit
• Sinon.js
• Wallaby*
There are styling languages/tools
• CSS
• compass
• Less
• PostCSS
• Sass
• Scss
• Stylus
There are boilerplate tools
• @angular/cli
• Seed projects
• yeoman
There are task runners
• (Gradle)
• Grunt
• Gulp
• (Maven)
• (Makefile)
• Npm
There are bundlers
• Brocholi
• Brunch
• Browserify
• Google Closure
• JSPM
• Rollup
• Webpack
• SystemJS
There are core JS Libraries
• Bacon
• Bluebird
• D3
• Hammerjs
• Jquery
• Lodash
• Lunr.js
• Modernizr
• Moment
• Rambda
• RxJs
• Three.js
• Underscore
• Zepto
There is Javascript Fatigue
https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f
Angular
• @angular/cli*
• CSS or SCSS – the only one true decision to make
• Codelyzer
• Jasmine
• Npm
• RxJs
• Webpack
• TSLint
• Typescript*
* You can replace, but you propably don’t want to
Workshop/Demo
• You should have installed:
• node >= 6.9.0 (https://nodejs.org/  download and install LTS)
• npm >= 3.0.0 (budled with node)
• git
• bash (winbash, gitbash, zsh)
• typescript aware IDE
• Intellij Idea Ultimate / Intellij Idea Ultimate EAP
• Microsoft Visual Studio Code
• Microsoft Visual Studio
• Atom
• Your favorite
Task 0 – Hello world (remind)
• npm install --global @angular/cli@latest # first time only
• ng new --ng4 my-project # first time only
Boilerplate, scripts, blueprints
• npm run build
• npm run test
• npm run lint
• npm run e2e
• npm run ng make-this-awesome
• npm run start -- --port 4444
• npm run ng -- generate <class | component | directive | enum |
guard | interface | module | pipe | service> [options] name
Typescript (open app.component.ts)
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'app works!';
}
ES2015 import modules Exported symbol from module Module in node_modules
Decorator
(not an annotation!)
POJO
ES2015 export modules
Syntactic sugar for
Object with prototypal inharitance
String property on instance
Task 1 – Count to a random number
Task 1 – Count to a random number
AppComponent
CounterComponent
RandomNumberGeneratorService
Plain old button
Task 1 – Count to a random number
• Create counter component
• Create Random Number Generator Interface
• Define the inferface
• Create a RNG Service
• Implement counter
• Generate random number
• Handle click
Task 1 – create counter component
• npm run ng -- generate component --inline-style --inline-template
counter
Typescript (open counter.component.ts)
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-counter',
template: `
<p>
counter Works!
</p>
`,
styles: []
})
export class CounterComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Template string
Constructor
Method Interface
Task 1 – create interface
• npm run ng -- generate interface random-number-generator
Typescript (replace random-number-generator.ts)
export interface RandomNumberGenerator {
readonly name: string;
readonly infoUrl: string;
next (state: any): {state: any, value: number};
reset (seed?: any): any;
}
Readonly property… …of type string
Return type
OptionalMethod signature Value of any type
(Simpliest ever random number generator)
(Simpliest ever random number generator)
https://xkcd.com/221/
Task 1 – create service
• npm run ng -- generate service xkcd-rng
import {Injectable} from '@angular/core';
import {RandomNumberGenerator} from './random-number-generator';
@Injectable()
export class XkcdRngService implements RandomNumberGenerator {
readonly infoUrl = 'https://xkcd.com/221/';
readonly name = 'XKCD Random Number Generator';
reset() {
return null;
}
next(state: any = null) {
return {state, value: 4};
}
}
Typescript (replace xkcd-rng.service.ts)
Default value
Property shorthand
Task 1 – implement counter
Angular (replace counter.component.ts)
import {Component, Input, Output, EventEmitter} from '@angular/core';
@Component({
selector: 'app-counter',
template: `{{ tick | async }}`,
})
export class CounterComponent {
@Input() counter = 5;
@Input() delay = 90;
@Output() finish = new EventEmitter<boolean>();
@Output() tick = new EventEmitter<number>();
public start(): void {
this.count(0);
}
private count(n: number): void {
this.tick.emit(n);
if (n >= this.counter) {
this.finish.emit(true);
} else {
setTimeout(() => this.count(n + 1), this.delay);
}
}
}
How to not write a large or scalable web applications.
It will count to 5
unless you specify
otherwise
It will be placed in <app-counter> element
It will display current tick number whenever it comes
It’s a component
It will wait 90ms
between ticks
unless you specify
otherwise
It will tell you about finish
It will tell you about tick
You can start counting down
Look! There is no $apply!
Task 1 – generate random number
Angular (replace app.component.ts, add XkcdRngService in providers in AppModule)
import {Component, OnInit} from '@angular/core';
import {XkcdRngService} from './xkcd-rng.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
counter: number;
constructor(public xkcd: XkcdRngService) {
}
ngOnInit(): void {
this.counter = this.xkcd.next().value;
}
}
Dependency injection
Assigned to component
if public/private specified
Lifecycle hook
providers: [
XkcdRngService,
],
Task 1 – handle click
Angular (replace app.component.{html,css}
<section>
<button (click)="cnt.start()">Start</button>
<h2>
<app-counter #cnt
[counter]="counter"></app-counter>
</h2>
</section>
h2 {
display: inline-block;
margin: 0;
}
button {
margin: 10px;
padding: 10px;
}
Input in app-counter Property from app-root
Handle output
Local template variable
- definition and usage
Access target component API
Task 2 – Multiple count to a random numbers
Task 2 – Multiple count to a random numbers
Task 1
RNG name and link
Random
independent
counters
Configurable
Task 2 – Multiple count to a random numbers
• Create another RNG service (this time configurable)
• Multiple counters
• Inject service
• Make service injection configurable which depends on environment
Task 2 – Create another RNG service
• npm run ng -- generate service lcg-rng-factory
Typescript / Angular (replace lcg-rng-factory.service.ts)
import {Injectable} from '@angular/core';
import {RandomNumberGenerator} from './random-number-generator';
interface LcgState { prev: number; multiplier: number; increment: number; modulo: number; }
const LCG_INFO_URL = 'https://en.wikipedia.org/wiki/Linear_congruential_generator';
@Injectable()
export class LcgRngFactoryService {
private createLcg(name: string, initialState: LcgState): RandomNumberGenerator {
return { infoUrl: LCG_INFO_URL, name,
reset: (seed = 1) => Object.assign({}, initialState, {prev: seed}),
next: (state: LcgState = initialState) => {
const prev = (state.multiplier * state.prev + state.increment) % state.modulo;
return {value: prev, state: Object.assign({}, state, {prev})};
}
};
}
public glibc() { return this.createLcg('glibc', {prev: 1, multiplier: 1103515245, increment: 12345, modulo: 2 ** 31 - 1}); }
public random0(){ return this.createLcg('random0', {prev: 1, multiplier: 8121, increment: 28411, modulo: 134456}); }
public minstd(){ return this.createLcg('minstd_rand', {prev: 1, multiplier: 48271, increment: 0, modulo: 2 ** 31 - 1}); }
}
Local
interface
Local
constant
Block
scope
variable Fat arrow function ("fart") – function without this
Angular (replace app.component.html)
<h1>RNG: <a [href]="rng.infoUrl">{{ rng.name }}</a></h1>
<section *ngFor="let counter of numbers">
<button (click)="cnt.start()">Start</button>
<h2>
<app-counter #cnt
[counter]="counter"></app-counter>
</h2>
</section>
ng-repeat replacement
Local variable
No changes here
Task 2 – Injectable RNG service
Angular – DI (replace app.component.ts body)
public numbers: number[];
private rngState: any;
constructor(public xkcd: XkcdRngService, @Inject('RNG') public rng: RandomNumberGenerator) { }
ngOnInit(): void {
this.rngState = this.rng.reset();
const length = 1 + this.xkcd.next().value % 10;
this.numbers = Array.from({length}).map(() => this.random());
}
private random(n = 50): number {
const {state, value} = this.rng.next(this.rngState);
this.rngState = state;
return value % n;
}
DI symbol
How to not write a large or scalable web applications.
export function rngFactory(lcg: LcgRngFactoryService, x: XkcdRngService){
if(environment.production){
return lcg.glibc();
}else{
return x;
}
}
@NgModule({
// ...
providers: [
XkcdRngService,
LcgRngFactoryService,
// {provide: 'RNG', useClass: XkcdRngService},
{provide: 'RNG', useFactory: rngFactory, deps: [LcgRngFactoryService, XkcdRngService]},
],
// ...
})
export class AppModule { }
Angular – DI (replace app.module.ts providers)
DI symbol
Comes from src/enviroments/*.ts
Serve in two variants of the enviroment
• npm run start -- --port 4444
• npm run start -- --port 4444 -e prod
Q&A
Paweł Żurowski <zurowski.pawel@gmail.com> 2017-03-23

More Related Content

What's hot (20)

Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Knoldus Inc.
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
Commit University
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
Dhyego Fernando
 
Developing a Demo Application with Angular 4 - J2I
Developing a Demo Application with Angular 4 - J2IDeveloping a Demo Application with Angular 4 - J2I
Developing a Demo Application with Angular 4 - J2I
Nader Debbabi
 
Angular 4 fronts
Angular 4 frontsAngular 4 fronts
Angular 4 fronts
badal dubla
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
An Intro to Angular 2
An Intro to Angular 2An Intro to Angular 2
An Intro to Angular 2
Ron Heft
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
Yakov Fain
 
Angular 4 - quick view
Angular 4 - quick viewAngular 4 - quick view
Angular 4 - quick view
Michael Haberman
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??
Laurent Duveau
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
Rohit Bishnoi
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
TejinderMakkar
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
jbandi
 
Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2
Ahmed Moawad
 
Angular 4 Introduction Tutorial
Angular 4 Introduction TutorialAngular 4 Introduction Tutorial
Angular 4 Introduction Tutorial
Scott Lee
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
Sam Dias
 
Angular 2: core concepts
Angular 2: core conceptsAngular 2: core concepts
Angular 2: core concepts
Codemotion
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
Express: A Jump-Start
Express: A Jump-StartExpress: A Jump-Start
Express: A Jump-Start
Naveen Pete
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Knoldus Inc.
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
Commit University
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
Dhyego Fernando
 
Developing a Demo Application with Angular 4 - J2I
Developing a Demo Application with Angular 4 - J2IDeveloping a Demo Application with Angular 4 - J2I
Developing a Demo Application with Angular 4 - J2I
Nader Debbabi
 
Angular 4 fronts
Angular 4 frontsAngular 4 fronts
Angular 4 fronts
badal dubla
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Codemotion
 
An Intro to Angular 2
An Intro to Angular 2An Intro to Angular 2
An Intro to Angular 2
Ron Heft
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
Yakov Fain
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??
Laurent Duveau
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
Rohit Bishnoi
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
TejinderMakkar
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
jbandi
 
Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2
Ahmed Moawad
 
Angular 4 Introduction Tutorial
Angular 4 Introduction TutorialAngular 4 Introduction Tutorial
Angular 4 Introduction Tutorial
Scott Lee
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
Sam Dias
 
Angular 2: core concepts
Angular 2: core conceptsAngular 2: core concepts
Angular 2: core concepts
Codemotion
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
Express: A Jump-Start
Express: A Jump-StartExpress: A Jump-Start
Express: A Jump-Start
Naveen Pete
 

Viewers also liked (20)

Architektura ngrx w angular 2+
Architektura ngrx w angular 2+Architektura ngrx w angular 2+
Architektura ngrx w angular 2+
Paweł Żurowski
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
Yakov Fain
 
Getting Started with Angular 2
Getting Started with Angular 2Getting Started with Angular 2
Getting Started with Angular 2
FITC
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 
Building Universal Applications with Angular 2
Building Universal Applications with Angular 2Building Universal Applications with Angular 2
Building Universal Applications with Angular 2
Minko Gechev
 
Hello AngularJS - Back to the future
Hello AngularJS - Back to the futureHello AngularJS - Back to the future
Hello AngularJS - Back to the future
Ouadie LAHDIOUI
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
Tu Hoang
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux Advanced
Visual Engineering
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John Pacaña
 
panduan-google-adsense.pdf
panduan-google-adsense.pdfpanduan-google-adsense.pdf
panduan-google-adsense.pdf
SMK Negeri 6 Malang
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
William Marques
 
React 101
React 101React 101
React 101
Casear Chu
 
004. Working with React component
004. Working with React component004. Working with React component
004. Working with React component
Binh Quan Duc
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with Reactjs
Thinh VoXuan
 
002. Working with Webpack
002. Working with Webpack002. Working with Webpack
002. Working with Webpack
Binh Quan Duc
 
001. Introduction about React
001. Introduction about React001. Introduction about React
001. Introduction about React
Binh Quan Duc
 
Exploiting Deserialization Vulnerabilities in Java
Exploiting Deserialization Vulnerabilities in JavaExploiting Deserialization Vulnerabilities in Java
Exploiting Deserialization Vulnerabilities in Java
CODE WHITE GmbH
 
Architektura ngrx w angular 2+
Architektura ngrx w angular 2+Architektura ngrx w angular 2+
Architektura ngrx w angular 2+
Paweł Żurowski
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
Yakov Fain
 
Getting Started with Angular 2
Getting Started with Angular 2Getting Started with Angular 2
Getting Started with Angular 2
FITC
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 
Building Universal Applications with Angular 2
Building Universal Applications with Angular 2Building Universal Applications with Angular 2
Building Universal Applications with Angular 2
Minko Gechev
 
Hello AngularJS - Back to the future
Hello AngularJS - Back to the futureHello AngularJS - Back to the future
Hello AngularJS - Back to the future
Ouadie LAHDIOUI
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
Tu Hoang
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux Advanced
Visual Engineering
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
William Marques
 
004. Working with React component
004. Working with React component004. Working with React component
004. Working with React component
Binh Quan Duc
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with Reactjs
Thinh VoXuan
 
002. Working with Webpack
002. Working with Webpack002. Working with Webpack
002. Working with Webpack
Binh Quan Duc
 
001. Introduction about React
001. Introduction about React001. Introduction about React
001. Introduction about React
Binh Quan Duc
 
Exploiting Deserialization Vulnerabilities in Java
Exploiting Deserialization Vulnerabilities in JavaExploiting Deserialization Vulnerabilities in Java
Exploiting Deserialization Vulnerabilities in Java
CODE WHITE GmbH
 
Ad

Similar to Quick introduction to Angular 4 for AngularJS 1.5 developers (20)

From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
Troy Miles
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
Nitin Bhojwani
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
GlobalLogic Ukraine
 
React inter3
React inter3React inter3
React inter3
Oswald Campesato
 
SF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSSSF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSS
Justin Ryan
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
Suresh Patidar
 
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработкиJS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JSFestUA
 
Rapid application development with spring roo j-fall 2010 - baris dere
Rapid application development with spring roo   j-fall 2010 - baris dereRapid application development with spring roo   j-fall 2010 - baris dere
Rapid application development with spring roo j-fall 2010 - baris dere
Baris Dere
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
Jadson Santos
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
Jim Lynch
 
Angular4 kickstart
Angular4 kickstartAngular4 kickstart
Angular4 kickstart
Foyzul Karim
 
Angular2.0@Shanghai0319
Angular2.0@Shanghai0319Angular2.0@Shanghai0319
Angular2.0@Shanghai0319
Bibby Chung
 
introductiontoangularwithasimplebutcompleteproject-171127023401.pptx
introductiontoangularwithasimplebutcompleteproject-171127023401.pptxintroductiontoangularwithasimplebutcompleteproject-171127023401.pptx
introductiontoangularwithasimplebutcompleteproject-171127023401.pptx
CHETHANKUMAR274045
 
Angular2 inter3
Angular2 inter3Angular2 inter3
Angular2 inter3
Oswald Campesato
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинAzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
JSC “Arcadia Inc”
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
Angular CLI : HelloWorld
Angular CLI : HelloWorldAngular CLI : HelloWorld
Angular CLI : HelloWorld
nikspatel007
 
Angular js
Angular jsAngular js
Angular js
E2 Partners
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
Troy Miles
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
Nitin Bhojwani
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
GlobalLogic Ukraine
 
SF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSSSF Gradle Meetup - Netflix OSS
SF Gradle Meetup - Netflix OSS
Justin Ryan
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
Suresh Patidar
 
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработкиJS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
JSFestUA
 
Rapid application development with spring roo j-fall 2010 - baris dere
Rapid application development with spring roo   j-fall 2010 - baris dereRapid application development with spring roo   j-fall 2010 - baris dere
Rapid application development with spring roo j-fall 2010 - baris dere
Baris Dere
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
Jadson Santos
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
Jim Lynch
 
Angular4 kickstart
Angular4 kickstartAngular4 kickstart
Angular4 kickstart
Foyzul Karim
 
Angular2.0@Shanghai0319
Angular2.0@Shanghai0319Angular2.0@Shanghai0319
Angular2.0@Shanghai0319
Bibby Chung
 
introductiontoangularwithasimplebutcompleteproject-171127023401.pptx
introductiontoangularwithasimplebutcompleteproject-171127023401.pptxintroductiontoangularwithasimplebutcompleteproject-171127023401.pptx
introductiontoangularwithasimplebutcompleteproject-171127023401.pptx
CHETHANKUMAR274045
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинAzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
JSC “Arcadia Inc”
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
Angular CLI : HelloWorld
Angular CLI : HelloWorldAngular CLI : HelloWorld
Angular CLI : HelloWorld
nikspatel007
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
Ad

Recently uploaded (20)

Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right WayMigrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and DartStep by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWSWomen in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA TechnologiesAI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdfHow to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration KeySmadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdfWhat is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and DartStep by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWSWomen in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA TechnologiesAI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdfHow to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration KeySmadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdfWhat is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 

Quick introduction to Angular 4 for AngularJS 1.5 developers

  • 1. Angular 4 Quick introduction for AngularJS 1.5 developers Paweł Żurowski <[email protected]> 2017-03-23
  • 2. Angular 4 Quick introduction for AngularJS 1.5 developers a.k.a. How to not write a large or scalable web applications. Paweł Żurowski <[email protected]> 2017-03-23
  • 3. Angular 4 Quick introduction for AngularJS 1.5 developers a.k.a. How to not write a large or scalable web applications. Paweł Żurowski <[email protected]> 2017-03-23
  • 4. Angular 4 Quick introduction for AngularJS 1.5 developers a.k.a. How to not write a large or scalable web applications. Paweł Żurowski <[email protected]> 2017-03-23
  • 5. Agenda • @AboutMe() • Javascript ecosystem (prepare the environment during this part) • Trends • Modules • Javascript fatigue • Workshop • Boilerplate • Blueprints • Typescript/Angular • Building blocks – service, component, dependency injection • Q&A Paweł Żurowski <[email protected]> 2017-03-23
  • 6. @AboutMe() • I started programming 18 years ago • I code for money from the 9 years • I code for Decerto 3 years • I was programming in Pascal, C, PHP, Javascript, Bash, SQL, C++, Java, Typescript • I did some AJAX before it was popular • I did some UX before it was so popular • I did some Devops before it was so named • I was programming SPAs over the last 4 years in AngularJS • I observe the development of Angular 2 since AngularJS 1.5-beta.0 • I am doing SPA in Angular 2 the last few months • I switch to Angular 4 in the coming weeks Paweł Żurowski <[email protected]> 2017-03-23
  • 7. @AboutMe() • I started programming 18 years ago • I code for money from the 9 years • I code for Decerto 3 years • I was programming in Pascal, C, PHP, Javascript, Bash, SQL, C++, Java, Typescript • I did some AJAX before it was popular • I did some UX before it was so popular • I did some Devops before it was so named • I was programming SPAs over the last 4 years in AngularJS • I observe the development of Angular 2 since AngularJS 1.5-beta.0 • I am doing SPA in Angular 2 the last few months • I switch to Angular 4 in the coming weeks Paweł Żurowski <[email protected]> 2017-03-23
  • 8. Workshop (It is the time to prepare environment) • You should have installed: • node >= 6.9.0 (https://nodejs.org/  download and install LTS) • npm >= 3.0.0 (bundled with node) • git • bash (winbash, gitbash, zsh) • typescript aware IDE • Intellij Idea Ultimate / Intellij Idea Ultimate EAP • Microsoft Visual Studio Code • Microsoft Visual Studio • Atom • Your favorite
  • 9. Task 0 – Hello world
  • 10. Task 0 – Hello world • npm install --global @angular/cli@latest # first time only • ng new --ng4 my-project # first time only # Let scripts do the work…
  • 15. Trends trends trends trends trends
  • 16. Trends trends trends trends trends trends
  • 17. Trends… • Trends proves (almost) every thesis • angular and react in game • It’s hard to say which is better • Angularjs migrates to Angular • Jquery still popular but it is going down
  • 18. Task 0 – Hello world (remind) • npm install --global @angular/cli@latest # first time only • ng new --ng4 my-project # first time only # Let scripts do the work…
  • 19. There are frameworks • Angular • AngularJS • Aurelia • Backbone • CycleJs • Elm • EmberJs • ExtJs • Knockout • Meteor • Mithril • Polymer • Preact • React • VueJs
  • 20. There are packages managers • Bower • Npm • (WebJars) • Yarn
  • 23. Task 0 – Hello world (remind) • npm install --global @angular/cli@latest # first time only • ng new --ng4 my-project # first time only # Let scripts do the work…
  • 24. There are languages • ClojureScript • CofeeScript • Dart • Ecmascript 5 • Ecmascript 2015 • Ecmasrcipt 2016 • Elm • Typescript
  • 25. There are compilers/transpilers • Babel • Clojure • CoffeScript • Dart • Elm • Emscripten • Google Closure Compiler • Typescript
  • 26. There are static analyzis tools • Codelyzer • JSHint • JSLint • TSLint
  • 27. There are template engines • HandleBars • Jade • JSX
  • 28. There are unit test frameworks • Ava • Chai • Jasmine • Mocha • Qunit • Sinon.js • Wallaby*
  • 29. There are styling languages/tools • CSS • compass • Less • PostCSS • Sass • Scss • Stylus
  • 30. There are boilerplate tools • @angular/cli • Seed projects • yeoman
  • 31. There are task runners • (Gradle) • Grunt • Gulp • (Maven) • (Makefile) • Npm
  • 32. There are bundlers • Brocholi • Brunch • Browserify • Google Closure • JSPM • Rollup • Webpack • SystemJS
  • 33. There are core JS Libraries • Bacon • Bluebird • D3 • Hammerjs • Jquery • Lodash • Lunr.js • Modernizr • Moment • Rambda • RxJs • Three.js • Underscore • Zepto
  • 34. There is Javascript Fatigue https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f
  • 35. Angular • @angular/cli* • CSS or SCSS – the only one true decision to make • Codelyzer • Jasmine • Npm • RxJs • Webpack • TSLint • Typescript* * You can replace, but you propably don’t want to
  • 36. Workshop/Demo • You should have installed: • node >= 6.9.0 (https://nodejs.org/  download and install LTS) • npm >= 3.0.0 (budled with node) • git • bash (winbash, gitbash, zsh) • typescript aware IDE • Intellij Idea Ultimate / Intellij Idea Ultimate EAP • Microsoft Visual Studio Code • Microsoft Visual Studio • Atom • Your favorite
  • 37. Task 0 – Hello world (remind) • npm install --global @angular/cli@latest # first time only • ng new --ng4 my-project # first time only
  • 38. Boilerplate, scripts, blueprints • npm run build • npm run test • npm run lint • npm run e2e • npm run ng make-this-awesome • npm run start -- --port 4444 • npm run ng -- generate <class | component | directive | enum | guard | interface | module | pipe | service> [options] name
  • 39. Typescript (open app.component.ts) import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { title = 'app works!'; } ES2015 import modules Exported symbol from module Module in node_modules Decorator (not an annotation!) POJO ES2015 export modules Syntactic sugar for Object with prototypal inharitance String property on instance
  • 40. Task 1 – Count to a random number
  • 41. Task 1 – Count to a random number AppComponent CounterComponent RandomNumberGeneratorService Plain old button
  • 42. Task 1 – Count to a random number • Create counter component • Create Random Number Generator Interface • Define the inferface • Create a RNG Service • Implement counter • Generate random number • Handle click
  • 43. Task 1 – create counter component • npm run ng -- generate component --inline-style --inline-template counter
  • 44. Typescript (open counter.component.ts) import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-counter', template: ` <p> counter Works! </p> `, styles: [] }) export class CounterComponent implements OnInit { constructor() { } ngOnInit() { } } Template string Constructor Method Interface
  • 45. Task 1 – create interface • npm run ng -- generate interface random-number-generator
  • 46. Typescript (replace random-number-generator.ts) export interface RandomNumberGenerator { readonly name: string; readonly infoUrl: string; next (state: any): {state: any, value: number}; reset (seed?: any): any; } Readonly property… …of type string Return type OptionalMethod signature Value of any type
  • 47. (Simpliest ever random number generator)
  • 48. (Simpliest ever random number generator) https://xkcd.com/221/
  • 49. Task 1 – create service • npm run ng -- generate service xkcd-rng
  • 50. import {Injectable} from '@angular/core'; import {RandomNumberGenerator} from './random-number-generator'; @Injectable() export class XkcdRngService implements RandomNumberGenerator { readonly infoUrl = 'https://xkcd.com/221/'; readonly name = 'XKCD Random Number Generator'; reset() { return null; } next(state: any = null) { return {state, value: 4}; } } Typescript (replace xkcd-rng.service.ts) Default value Property shorthand
  • 51. Task 1 – implement counter
  • 52. Angular (replace counter.component.ts) import {Component, Input, Output, EventEmitter} from '@angular/core'; @Component({ selector: 'app-counter', template: `{{ tick | async }}`, }) export class CounterComponent { @Input() counter = 5; @Input() delay = 90; @Output() finish = new EventEmitter<boolean>(); @Output() tick = new EventEmitter<number>(); public start(): void { this.count(0); } private count(n: number): void { this.tick.emit(n); if (n >= this.counter) { this.finish.emit(true); } else { setTimeout(() => this.count(n + 1), this.delay); } } } How to not write a large or scalable web applications. It will count to 5 unless you specify otherwise It will be placed in <app-counter> element It will display current tick number whenever it comes It’s a component It will wait 90ms between ticks unless you specify otherwise It will tell you about finish It will tell you about tick You can start counting down Look! There is no $apply!
  • 53. Task 1 – generate random number
  • 54. Angular (replace app.component.ts, add XkcdRngService in providers in AppModule) import {Component, OnInit} from '@angular/core'; import {XkcdRngService} from './xkcd-rng.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { counter: number; constructor(public xkcd: XkcdRngService) { } ngOnInit(): void { this.counter = this.xkcd.next().value; } } Dependency injection Assigned to component if public/private specified Lifecycle hook providers: [ XkcdRngService, ],
  • 55. Task 1 – handle click
  • 56. Angular (replace app.component.{html,css} <section> <button (click)="cnt.start()">Start</button> <h2> <app-counter #cnt [counter]="counter"></app-counter> </h2> </section> h2 { display: inline-block; margin: 0; } button { margin: 10px; padding: 10px; } Input in app-counter Property from app-root Handle output Local template variable - definition and usage Access target component API
  • 57. Task 2 – Multiple count to a random numbers
  • 58. Task 2 – Multiple count to a random numbers Task 1 RNG name and link Random independent counters Configurable
  • 59. Task 2 – Multiple count to a random numbers • Create another RNG service (this time configurable) • Multiple counters • Inject service • Make service injection configurable which depends on environment
  • 60. Task 2 – Create another RNG service • npm run ng -- generate service lcg-rng-factory
  • 61. Typescript / Angular (replace lcg-rng-factory.service.ts) import {Injectable} from '@angular/core'; import {RandomNumberGenerator} from './random-number-generator'; interface LcgState { prev: number; multiplier: number; increment: number; modulo: number; } const LCG_INFO_URL = 'https://en.wikipedia.org/wiki/Linear_congruential_generator'; @Injectable() export class LcgRngFactoryService { private createLcg(name: string, initialState: LcgState): RandomNumberGenerator { return { infoUrl: LCG_INFO_URL, name, reset: (seed = 1) => Object.assign({}, initialState, {prev: seed}), next: (state: LcgState = initialState) => { const prev = (state.multiplier * state.prev + state.increment) % state.modulo; return {value: prev, state: Object.assign({}, state, {prev})}; } }; } public glibc() { return this.createLcg('glibc', {prev: 1, multiplier: 1103515245, increment: 12345, modulo: 2 ** 31 - 1}); } public random0(){ return this.createLcg('random0', {prev: 1, multiplier: 8121, increment: 28411, modulo: 134456}); } public minstd(){ return this.createLcg('minstd_rand', {prev: 1, multiplier: 48271, increment: 0, modulo: 2 ** 31 - 1}); } } Local interface Local constant Block scope variable Fat arrow function ("fart") – function without this
  • 62. Angular (replace app.component.html) <h1>RNG: <a [href]="rng.infoUrl">{{ rng.name }}</a></h1> <section *ngFor="let counter of numbers"> <button (click)="cnt.start()">Start</button> <h2> <app-counter #cnt [counter]="counter"></app-counter> </h2> </section> ng-repeat replacement Local variable No changes here
  • 63. Task 2 – Injectable RNG service
  • 64. Angular – DI (replace app.component.ts body) public numbers: number[]; private rngState: any; constructor(public xkcd: XkcdRngService, @Inject('RNG') public rng: RandomNumberGenerator) { } ngOnInit(): void { this.rngState = this.rng.reset(); const length = 1 + this.xkcd.next().value % 10; this.numbers = Array.from({length}).map(() => this.random()); } private random(n = 50): number { const {state, value} = this.rng.next(this.rngState); this.rngState = state; return value % n; } DI symbol How to not write a large or scalable web applications.
  • 65. export function rngFactory(lcg: LcgRngFactoryService, x: XkcdRngService){ if(environment.production){ return lcg.glibc(); }else{ return x; } } @NgModule({ // ... providers: [ XkcdRngService, LcgRngFactoryService, // {provide: 'RNG', useClass: XkcdRngService}, {provide: 'RNG', useFactory: rngFactory, deps: [LcgRngFactoryService, XkcdRngService]}, ], // ... }) export class AppModule { } Angular – DI (replace app.module.ts providers) DI symbol Comes from src/enviroments/*.ts
  • 66. Serve in two variants of the enviroment • npm run start -- --port 4444 • npm run start -- --port 4444 -e prod