SlideShare a Scribd company logo
1 of 38
GetTogether
Getting more out of TypeScript and
Angular 2
Ruben Haeck
28/03/2017
2 of 38
Agenda
• Intro
• TypeScript
• From AngularJS to Angular
• Demo
3 of 38
Intro
• Ruben Haeck
– Queaso Systems NV
– 11 jaar ervaring
– rh@queaso.be
4 of 38
Tools
• Visual Studio 2015/2017
– Belangrijk: Web Essentials
• o.a compilatie → TypeScipt, LESS, …
• Visual Studio Code (1.10.2)
• WebStorm
• Google Chrome
• Pluncker → https://plnkr.co
5 of 38
TypeScript
let’s go typed
6 of 38
TypeScript
• Meta language → JavaScript
• Compileert → JavaScript
• By Microsoft, open source
• Uitbreiding JavaScript
– Strongly typed class-based environment
• http://www.typescriptlang.org
7 of 38
TypeScript (JS)
8 of 38
TypeScript (TS)
9 of 38
Voordelen
• Handige → Large-scale JS applications
• Volgt de ECMAScript 6 standaard
• IDE ondersteuning
– Intellisense
• Compile-time type checking
10 of 38
Compile
• NodeJS
• Visual Studio 2015
– Plugin for TypeScript
– Web Essentials extension
• Andere
– TypeScript gecompileerd door TypeScript
• Client side by SystemJS
npm install –g typescript
tsc basics.ts
tsc basics.ts
11 of 38
TypeScript Fundamentals
• Basic types
• Variables
• Functions
– Declaration, overloading
• Interfaces
• Classes
– Constructors, Implemenation, Inheritance
12 of 38
TypeScript Fundamentals
• Generics
• Enums
• Namespaces
• Modules
13 of 38
TypeScript Fundamentals
• Basic types
– any
• Supertype of all types
• Als type niet is gekend → any
– Primitieve types
•number, string, boolean
• Opgelet: Object → interface!
14 of 38
• Array types
• Object type
• Void type
– Enkel als return type → functie
TypeScript Fundamentals
var names: string[]
var names: Array<string>
var car: { name: string, company: string};
car = { name: ‘BMW’, company: ‘Queaso
Systems’}
function logMe(text: string) : void {
console.log(text);
}
15 of 38
TypeScript Fundamentals
• Interfaces
interface IPerson {
name: string;
}
interface IQueasoEmployee extends IPerson {
happy: boolean;
age: number;
savePerson(person: IPerson): void;
}
multiple inheritance
16 of 38
TypeScript Fundamentals
• Classes
– Instance members
– Static members
– Access modifiers
– Constructors
– Interface implementation
– Class inheritance
17 of 38
TypeScript Fundamentals
class Employee {
// # constructor(s)
constructor(public name: string, public firstName: string,
public companyName: string){
}
public save(name: string,firstName: string) : string {
Employee.totalNumberOfEmployeeSaved += 1;
return this.name + ' '+ firstName + 'just saved ';
}
static totalNumberOfEmployeeSaved: number = 0;
}
18 of 38
TypeScript Fundamentals
var emp = new Employee('Haeck','Ruben','Queaso Systems');
emp.save('Wayne','Bruce');
// returns 'Haeck Bruce just saved'
19 of 38
TypeScript Fundamentals
• Access modifiers
– Public, private and protected
class Car {
public price: number;
private priceeWithVAT: number;
}
20 of 38
TypeScript Fundamentals
• Interface implementation
• Class inheritance
class Car implements ICar {
…
}
class SecretCar extends Car {
constructor(name: string, power: number, alias: string){
super(name, power);
}
}
21 of 38
From AngularJS to Angular
22 of 38
TypeScript
• Heel veel info
– https://www.typescriptlang.org/
23 of 38
Angular
• Sneller/Performant
• Eenvoudiger
• Response webdesign
24 of 38
Releases
2010
• Initiële (instabiele) release (0.9.0)
2012
• Release 1.1
• Initiële versie TypeScript (0.8.0)
2013
• Release 1.2 → Drop support IE6 & IE7
2014
• Release 1.3 → Drop support IE8
• Release TypeScript 1.1
25 of 38
Releases
07/2016
• Release 1.5.8 → Introductie “components”
09/2016
• Release 2.0 → “Angular”
• Release TypeScript 2.0 → introductie “@types/…”
2017
• Release 4
• Release 5
2018
• Release 6
• Release 7
26 of 38
Languages
• EcmaScript 5
• EcmaScript 6 (2015)
• TypeScript
• Dart
compile
types
JavaScript
27 of 38
Modules
AngularJS (JS) Angular (TS)
(function(){
// add third party libs
angular.module(‘app’,[]);
})();
<div ng-app=“app”>
…
</div>
import { BrowserModule } from '@angular/platform-
browser';
import { NgModule } from '@angular/core';
@NgModule({
imports: [
BrowserModule],
providers: […],
bootstrap: […]
})
export class AppModule { }
28 of 38
Controllers →
AngularJS (TS) Angular (TS)
class CompanyController {
name: string = ‘Queaso Systems’;
constructor() { }
}
angular.module(‘app’)
.controller(‘CompanyController’,
CompanyController);
<div ng-
controller=“CompanyController as
vm”>
{{ vm.name }}
</div>
import { BrowserModule } from '@angular/platform-
browser';
import { NgModule } from '@angular/core';
@Component({
selector: ‘company-card’,
template: ‘<h1>{{ company.name }}</h1>’
})
export class CompanyComponent {
company = { name: ‘Queaso Systems’, id: 1 };
}
<company-card></company-card>
Components
29 of 38
Built-in directives
AngularJS (HTML) Angular (HTML)
<table>
<tr ng-repeat=“e in
vm.employees” >
<td>{{ e.name }}</td>
</table>
<div ng-show=“vm.isEU”>
Is part of the EU!
</div>
<table>
<tr *ngFor=“e of employees”>
<td>{{ e.name }}</td>
</tr>
</table>
<div *ngIf=“isEU”>
Is part of the EU!
</div>
30 of 38
1 Way Binding
AngularJS (HTML) Angular (HTML)
<h1 ng-bind=“vm.company.name”>
</h1>
<h1 [innerText]=“company.name”></h1>
31 of 38
Event Binding
AngularJS (HTML) Angular (HTML)
<input type=“button”
ng-click=“vm.showDetail()”
value=“OK” />
<input type=“button”
(click)=“showDetail()”
value=“OK’ />
32 of 38
2 Way Binding
AngularJS (HTML) Angular (HTML)
<input type=“button”
ng-model=“vm.company.name”
/>
<input type=“button”
[(ngModel)]=“company.name”
/>
33 of 38
Services
registraties
AngularJS (TS) Angular (TS)
export class QueasoService {
constructor() { }
countEmployees(): number {
return 25;
}
}
angular.module(‘app’)
.service(‘QService’,
QueasoService);
@Injectable()
export class QueasoService {
countEmployees(): number {
return 25;
}
}
34 of 38
Services
resolving
AngularJS (TS) Angular (TS)
class AppController {
static $inject = [‘QService’];
constructor(queasoService:
QueasoService){
let x = queasoService
.countEmployees();
}
}
@Component({ … })
class AppComponent {
constructor(queasoService: QueasoService) {
let x = queasoService.countEmployees();
}
}
35 of 38
Promise vs Observable
• Promise
– 1 value
– Not Cancelable
– Geen utility methodes
• Observable
– Superset van promises
– Meerdere values
– Cancelable
– Utility methods
• Streams
36 of 38
Services
Http
AngularJS (TS) Angular (TS)
class QueasoDataService {
baseUrl = 'http://api.queaso.be
';
static $inject = ['$http'];
constructor(private $http: ang
ular.IHttpService){
}
getEmployees(): angular.IHttpP
romise<Array<Employee>> {
return this.$http
.get(this.baseUrl + '/employees'
);
}
}
Import { Http, Response } from ‘@angular/http’
@Injectable()
class QueasoDataService {
baseUrl = 'http://api.queaso.be';
constructor(http: Http) { }
getEmployees(): Observable<Array<Employee>> {
return this.http.get(this.baseUrl)
.map((result: Response) => result.json())
.catch((error: any) => Observable.throw(…));
}
}
37 of 38
Services
Http
AngularJS (TS) Angular (TS)
class AppController {
employees: Array<Employee>;
static $inject = ['
QueasoDataService'];
constructor(private qService:
QueasoDataService){
qService.getEmployees().then(
(result: any) => {
employees = result.data
});
}
}
class AppComponent {
employees: Array<Employee>;
constructor(qService: QueasoDataService) {
qService.getEmployees().subscribe(
x => this.employees,
error => {
console.log(error);
});
}
}
38 of 38
• Demo
– angular-cli
– Spotify api
Ad

More Related Content

What's hot (7)

Pharo Optimising JIT Internals
Pharo Optimising JIT InternalsPharo Optimising JIT Internals
Pharo Optimising JIT Internals
ESUG
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Fwdays
 
Borland star team to tfs simple migration
Borland star team to tfs simple migrationBorland star team to tfs simple migration
Borland star team to tfs simple migration
Shreesha Rao
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Luciano Mammino
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
Commit University
 
Express: A Jump-Start
Express: A Jump-StartExpress: A Jump-Start
Express: A Jump-Start
Naveen Pete
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Ontico
 
Pharo Optimising JIT Internals
Pharo Optimising JIT InternalsPharo Optimising JIT Internals
Pharo Optimising JIT Internals
ESUG
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Fwdays
 
Borland star team to tfs simple migration
Borland star team to tfs simple migrationBorland star team to tfs simple migration
Borland star team to tfs simple migration
Shreesha Rao
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Luciano Mammino
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
Commit University
 
Express: A Jump-Start
Express: A Jump-StartExpress: A Jump-Start
Express: A Jump-Start
Naveen Pete
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Ontico
 

Viewers also liked (18)

TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John Pacaña
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
Paweł Żurowski
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
Développement web mobile avec IONIC 2
Développement web mobile avec IONIC 2Développement web mobile avec IONIC 2
Développement web mobile avec IONIC 2
Jean David Olekhnovitch
 
1.1.7 Система огнестойких проходок Vulcan
1.1.7 Система огнестойких проходок Vulcan1.1.7 Система огнестойких проходок Vulcan
1.1.7 Система огнестойких проходок Vulcan
Igor Golovin
 
oyene safety cv
oyene safety cvoyene safety cv
oyene safety cv
oyene zacharias abiranyah
 
Betaleadership De Gestores de Recursos Humanos a Makers de Interacciones Humanas
Betaleadership De Gestores de Recursos Humanos a Makers de Interacciones HumanasBetaleadership De Gestores de Recursos Humanos a Makers de Interacciones Humanas
Betaleadership De Gestores de Recursos Humanos a Makers de Interacciones Humanas
Sylvain Loubradou
 
Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...
Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...
Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...
Tarja Röytiö
 
Brochure eventos Spiwak
Brochure eventos SpiwakBrochure eventos Spiwak
Brochure eventos Spiwak
Hotel Stancia Spiwak
 
1.1.9 Система Angara и дренажные трубы
1.1.9 Система Angara и дренажные трубы 1.1.9 Система Angara и дренажные трубы
1.1.9 Система Angara и дренажные трубы
Igor Golovin
 
Auto del Tribunal Supremo. Sala Cuarta.
Auto del Tribunal Supremo. Sala Cuarta.Auto del Tribunal Supremo. Sala Cuarta.
Auto del Tribunal Supremo. Sala Cuarta.
Juan Segura Aguiló
 
Active Procrastination
Active ProcrastinationActive Procrastination
Active Procrastination
Nupur_Deshpande
 
Baby's First Open Source Project
Baby's First Open Source ProjectBaby's First Open Source Project
Baby's First Open Source Project
Julien Fitzpatrick
 
برنامج مقترح لتعلم (تعلم الآلة)
برنامج مقترح لتعلم (تعلم الآلة)برنامج مقترح لتعلم (تعلم الآلة)
برنامج مقترح لتعلم (تعلم الآلة)
Fares Al-Qunaieer
 
Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...
Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...
Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...
Eiji Sasahara, Ph.D., MBA 笹原英司
 
Fotosíntesis del futuro
Fotosíntesis del futuroFotosíntesis del futuro
Fotosíntesis del futuro
Merelyn Valdivia
 
Le sourire au naturel. Métamorphoses du portrait photographique
Le sourire au naturel. Métamorphoses du portrait photographiqueLe sourire au naturel. Métamorphoses du portrait photographique
Le sourire au naturel. Métamorphoses du portrait photographique
André Gunthert
 
ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...
ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...
ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...
o2adv تسويق وارشفة مسك كلمات بجوجل
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
Paweł Żurowski
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
1.1.7 Система огнестойких проходок Vulcan
1.1.7 Система огнестойких проходок Vulcan1.1.7 Система огнестойких проходок Vulcan
1.1.7 Система огнестойких проходок Vulcan
Igor Golovin
 
Betaleadership De Gestores de Recursos Humanos a Makers de Interacciones Humanas
Betaleadership De Gestores de Recursos Humanos a Makers de Interacciones HumanasBetaleadership De Gestores de Recursos Humanos a Makers de Interacciones Humanas
Betaleadership De Gestores de Recursos Humanos a Makers de Interacciones Humanas
Sylvain Loubradou
 
Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...
Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...
Miten markkinoinnin automaation käyttöönotto aloitti tekijöitään suuremman mu...
Tarja Röytiö
 
1.1.9 Система Angara и дренажные трубы
1.1.9 Система Angara и дренажные трубы 1.1.9 Система Angara и дренажные трубы
1.1.9 Система Angara и дренажные трубы
Igor Golovin
 
Auto del Tribunal Supremo. Sala Cuarta.
Auto del Tribunal Supremo. Sala Cuarta.Auto del Tribunal Supremo. Sala Cuarta.
Auto del Tribunal Supremo. Sala Cuarta.
Juan Segura Aguiló
 
Baby's First Open Source Project
Baby's First Open Source ProjectBaby's First Open Source Project
Baby's First Open Source Project
Julien Fitzpatrick
 
برنامج مقترح لتعلم (تعلم الآلة)
برنامج مقترح لتعلم (تعلم الآلة)برنامج مقترح لتعلم (تعلم الآلة)
برنامج مقترح لتعلم (تعلم الآلة)
Fares Al-Qunaieer
 
Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...
Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...
Cloud Security Alliance Japan Chapter Big Data User Working Group 2014 action...
Eiji Sasahara, Ph.D., MBA 笹原英司
 
Le sourire au naturel. Métamorphoses du portrait photographique
Le sourire au naturel. Métamorphoses du portrait photographiqueLe sourire au naturel. Métamorphoses du portrait photographique
Le sourire au naturel. Métamorphoses du portrait photographique
André Gunthert
 
ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...
ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...
ارقام شركات مكافحة الحشرات بمكة رش مبيديات النمل الابيض الاسود الصراصير بق ال...
o2adv تسويق وارشفة مسك كلمات بجوجل
 
Ad

Similar to Get together on getting more out of typescript &amp; angular 2 (20)

Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
WebFrameworks
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
Yakov Fain
 
angular2.0
angular2.0angular2.0
angular2.0
Jaime L. López Carratalá
 
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
Betclic Everest Group Tech Team
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Nicolas HAAN
 
Webinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsWebinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamics
Todd Radel
 
React inter3
React inter3React inter3
React inter3
Oswald Campesato
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and Future
Igalia
 
Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)
ITCamp
 
Javascript
JavascriptJavascript
Javascript
Sun Technlogies
 
Angular2 inter3
Angular2 inter3Angular2 inter3
Angular2 inter3
Oswald Campesato
 
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
 
From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2
Alessandro Molina
 
Angular
AngularAngular
Angular
Lilia Sfaxi
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
ondrejbalas
 
Tech talks#6: Code Refactoring
Tech talks#6: Code RefactoringTech talks#6: Code Refactoring
Tech talks#6: Code Refactoring
Nguyễn Việt Khoa
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
Janel Heilbrunn
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
ICS
 
Front end microservices - October 2019
Front end microservices - October 2019Front end microservices - October 2019
Front end microservices - October 2019
Mikhail Kuznetcov
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
WebFrameworks
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
Yakov Fain
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Nicolas HAAN
 
Webinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsWebinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamics
Todd Radel
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and Future
Igalia
 
Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)Busy Developers Guide to AngularJS (Tiberiu Covaci)
Busy Developers Guide to AngularJS (Tiberiu Covaci)
ITCamp
 
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
 
From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2From SQLAlchemy to Ming with TurboGears2
From SQLAlchemy to Ming with TurboGears2
Alessandro Molina
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
ondrejbalas
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
Janel Heilbrunn
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
ICS
 
Front end microservices - October 2019
Front end microservices - October 2019Front end microservices - October 2019
Front end microservices - October 2019
Mikhail Kuznetcov
 
Ad

Recently uploaded (20)

Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Connect and Protect: Networks and Network Security
Connect and Protect: Networks and Network SecurityConnect and Protect: Networks and Network Security
Connect and Protect: Networks and Network Security
VICTOR MAESTRE RAMIREZ
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
Vibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdfVibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
Make GenAI investments go further with the Dell AI Factory
Make GenAI investments go further with the Dell AI FactoryMake GenAI investments go further with the Dell AI Factory
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Connect and Protect: Networks and Network Security
Connect and Protect: Networks and Network SecurityConnect and Protect: Networks and Network Security
Connect and Protect: Networks and Network Security
VICTOR MAESTRE RAMIREZ
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
Vibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdfVibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
Make GenAI investments go further with the Dell AI Factory
Make GenAI investments go further with the Dell AI FactoryMake GenAI investments go further with the Dell AI Factory
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 

Get together on getting more out of typescript &amp; angular 2

  • 1. 1 of 38 GetTogether Getting more out of TypeScript and Angular 2 Ruben Haeck 28/03/2017
  • 2. 2 of 38 Agenda • Intro • TypeScript • From AngularJS to Angular • Demo
  • 3. 3 of 38 Intro • Ruben Haeck – Queaso Systems NV – 11 jaar ervaring – [email protected]
  • 4. 4 of 38 Tools • Visual Studio 2015/2017 – Belangrijk: Web Essentials • o.a compilatie → TypeScipt, LESS, … • Visual Studio Code (1.10.2) • WebStorm • Google Chrome • Pluncker → https://plnkr.co
  • 6. 6 of 38 TypeScript • Meta language → JavaScript • Compileert → JavaScript • By Microsoft, open source • Uitbreiding JavaScript – Strongly typed class-based environment • http://www.typescriptlang.org
  • 9. 9 of 38 Voordelen • Handige → Large-scale JS applications • Volgt de ECMAScript 6 standaard • IDE ondersteuning – Intellisense • Compile-time type checking
  • 10. 10 of 38 Compile • NodeJS • Visual Studio 2015 – Plugin for TypeScript – Web Essentials extension • Andere – TypeScript gecompileerd door TypeScript • Client side by SystemJS npm install –g typescript tsc basics.ts tsc basics.ts
  • 11. 11 of 38 TypeScript Fundamentals • Basic types • Variables • Functions – Declaration, overloading • Interfaces • Classes – Constructors, Implemenation, Inheritance
  • 12. 12 of 38 TypeScript Fundamentals • Generics • Enums • Namespaces • Modules
  • 13. 13 of 38 TypeScript Fundamentals • Basic types – any • Supertype of all types • Als type niet is gekend → any – Primitieve types •number, string, boolean • Opgelet: Object → interface!
  • 14. 14 of 38 • Array types • Object type • Void type – Enkel als return type → functie TypeScript Fundamentals var names: string[] var names: Array<string> var car: { name: string, company: string}; car = { name: ‘BMW’, company: ‘Queaso Systems’} function logMe(text: string) : void { console.log(text); }
  • 15. 15 of 38 TypeScript Fundamentals • Interfaces interface IPerson { name: string; } interface IQueasoEmployee extends IPerson { happy: boolean; age: number; savePerson(person: IPerson): void; } multiple inheritance
  • 16. 16 of 38 TypeScript Fundamentals • Classes – Instance members – Static members – Access modifiers – Constructors – Interface implementation – Class inheritance
  • 17. 17 of 38 TypeScript Fundamentals class Employee { // # constructor(s) constructor(public name: string, public firstName: string, public companyName: string){ } public save(name: string,firstName: string) : string { Employee.totalNumberOfEmployeeSaved += 1; return this.name + ' '+ firstName + 'just saved '; } static totalNumberOfEmployeeSaved: number = 0; }
  • 18. 18 of 38 TypeScript Fundamentals var emp = new Employee('Haeck','Ruben','Queaso Systems'); emp.save('Wayne','Bruce'); // returns 'Haeck Bruce just saved'
  • 19. 19 of 38 TypeScript Fundamentals • Access modifiers – Public, private and protected class Car { public price: number; private priceeWithVAT: number; }
  • 20. 20 of 38 TypeScript Fundamentals • Interface implementation • Class inheritance class Car implements ICar { … } class SecretCar extends Car { constructor(name: string, power: number, alias: string){ super(name, power); } }
  • 21. 21 of 38 From AngularJS to Angular
  • 22. 22 of 38 TypeScript • Heel veel info – https://www.typescriptlang.org/
  • 23. 23 of 38 Angular • Sneller/Performant • Eenvoudiger • Response webdesign
  • 24. 24 of 38 Releases 2010 • Initiële (instabiele) release (0.9.0) 2012 • Release 1.1 • Initiële versie TypeScript (0.8.0) 2013 • Release 1.2 → Drop support IE6 & IE7 2014 • Release 1.3 → Drop support IE8 • Release TypeScript 1.1
  • 25. 25 of 38 Releases 07/2016 • Release 1.5.8 → Introductie “components” 09/2016 • Release 2.0 → “Angular” • Release TypeScript 2.0 → introductie “@types/…” 2017 • Release 4 • Release 5 2018 • Release 6 • Release 7
  • 26. 26 of 38 Languages • EcmaScript 5 • EcmaScript 6 (2015) • TypeScript • Dart compile types JavaScript
  • 27. 27 of 38 Modules AngularJS (JS) Angular (TS) (function(){ // add third party libs angular.module(‘app’,[]); })(); <div ng-app=“app”> … </div> import { BrowserModule } from '@angular/platform- browser'; import { NgModule } from '@angular/core'; @NgModule({ imports: [ BrowserModule], providers: […], bootstrap: […] }) export class AppModule { }
  • 28. 28 of 38 Controllers → AngularJS (TS) Angular (TS) class CompanyController { name: string = ‘Queaso Systems’; constructor() { } } angular.module(‘app’) .controller(‘CompanyController’, CompanyController); <div ng- controller=“CompanyController as vm”> {{ vm.name }} </div> import { BrowserModule } from '@angular/platform- browser'; import { NgModule } from '@angular/core'; @Component({ selector: ‘company-card’, template: ‘<h1>{{ company.name }}</h1>’ }) export class CompanyComponent { company = { name: ‘Queaso Systems’, id: 1 }; } <company-card></company-card> Components
  • 29. 29 of 38 Built-in directives AngularJS (HTML) Angular (HTML) <table> <tr ng-repeat=“e in vm.employees” > <td>{{ e.name }}</td> </table> <div ng-show=“vm.isEU”> Is part of the EU! </div> <table> <tr *ngFor=“e of employees”> <td>{{ e.name }}</td> </tr> </table> <div *ngIf=“isEU”> Is part of the EU! </div>
  • 30. 30 of 38 1 Way Binding AngularJS (HTML) Angular (HTML) <h1 ng-bind=“vm.company.name”> </h1> <h1 [innerText]=“company.name”></h1>
  • 31. 31 of 38 Event Binding AngularJS (HTML) Angular (HTML) <input type=“button” ng-click=“vm.showDetail()” value=“OK” /> <input type=“button” (click)=“showDetail()” value=“OK’ />
  • 32. 32 of 38 2 Way Binding AngularJS (HTML) Angular (HTML) <input type=“button” ng-model=“vm.company.name” /> <input type=“button” [(ngModel)]=“company.name” />
  • 33. 33 of 38 Services registraties AngularJS (TS) Angular (TS) export class QueasoService { constructor() { } countEmployees(): number { return 25; } } angular.module(‘app’) .service(‘QService’, QueasoService); @Injectable() export class QueasoService { countEmployees(): number { return 25; } }
  • 34. 34 of 38 Services resolving AngularJS (TS) Angular (TS) class AppController { static $inject = [‘QService’]; constructor(queasoService: QueasoService){ let x = queasoService .countEmployees(); } } @Component({ … }) class AppComponent { constructor(queasoService: QueasoService) { let x = queasoService.countEmployees(); } }
  • 35. 35 of 38 Promise vs Observable • Promise – 1 value – Not Cancelable – Geen utility methodes • Observable – Superset van promises – Meerdere values – Cancelable – Utility methods • Streams
  • 36. 36 of 38 Services Http AngularJS (TS) Angular (TS) class QueasoDataService { baseUrl = 'http://api.queaso.be '; static $inject = ['$http']; constructor(private $http: ang ular.IHttpService){ } getEmployees(): angular.IHttpP romise<Array<Employee>> { return this.$http .get(this.baseUrl + '/employees' ); } } Import { Http, Response } from ‘@angular/http’ @Injectable() class QueasoDataService { baseUrl = 'http://api.queaso.be'; constructor(http: Http) { } getEmployees(): Observable<Array<Employee>> { return this.http.get(this.baseUrl) .map((result: Response) => result.json()) .catch((error: any) => Observable.throw(…)); } }
  • 37. 37 of 38 Services Http AngularJS (TS) Angular (TS) class AppController { employees: Array<Employee>; static $inject = [' QueasoDataService']; constructor(private qService: QueasoDataService){ qService.getEmployees().then( (result: any) => { employees = result.data }); } } class AppComponent { employees: Array<Employee>; constructor(qService: QueasoDataService) { qService.getEmployees().subscribe( x => this.employees, error => { console.log(error); }); } }
  • 38. 38 of 38 • Demo – angular-cli – Spotify api