angular 2.0

37
Spreker Tom Hanekamp Datum 25-08-2015 I have not failed. I've just found 10,000 ways that won't work. Thomas A. Edison Angular 2.0

Upload: thanekamp

Post on 11-Apr-2017

1.173 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Angular 2.0

Spreker Tom Hanekamp Datum 25-08-2015

I have not failed. I've just found 10,000 ways that won't work. Thomas A. Edison

Angular 2.0

Page 2: Angular 2.0

Agenda

A brief history of AngularJS

Angular 2.0, what’s the news?

Getting started with Angular 2.0

Page 3: Angular 2.0

A brief history of AngularJS

<angular />

Page 4: Angular 2.0

A brief history of AngularJS

Page 5: Angular 2.0

A brief history of AngularJS

Page 6: Angular 2.0

A brief history of AngularJS

Page 7: Angular 2.0

A brief history of AngularJS

Page 8: Angular 2.0

A brief history of AngularJS

Page 9: Angular 2.0

Angular 2.0, whats the news?

Mobile first

Page 10: Angular 2.0

Angular 2.0, whats the news?

Made for the web of tomorrow

Page 11: Angular 2.0

Angular 2.0, whats the news?

Modularity

Page 12: Angular 2.0

Mostly finished

Check: https://github.com/angular/router

Angular 2.0, whats the news?

New router

Page 13: Angular 2.0

Change detection

Angular 2.0, whats the news?

Model Directive DOM

Directive Directive

Model Model

Page 14: Angular 2.0

Angular 2.0, whats the news?

Change detection

Model Components DOM

Page 15: Angular 2.0

Angular 2.0, whats the news?

Change detection

x iterations 1 iteration

Page 16: Angular 2.0

Angular 2.0, whats the news?

Change detection

Page 17: Angular 2.0

Angular 2.0, whats the news?

Change detection

Page 18: Angular 2.0

Angular 2.0, whats the news?

Change detection

Page 19: Angular 2.0

Angular 2.0, whats the news?

Change detection

Page 20: Angular 2.0

Angular 2.0, whats the news?

Change detection

Page 21: Angular 2.0

Angular 2.0, whats the news?

Change detection

Page 22: Angular 2.0

No usage of existing module loaders

Complex API

Strings as IDs

No lazy loading

All services are singletons

Angular 2.0, whats the news?

Dependency Injection

Page 23: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionclass Gardener {

constructor(sprinkler, rake) {

this.sprinkler = sprinkler;

this.rake = rake;

}

doGardening() {

this.sprinkler.waterFlowers();

this.rake.rakeFallenLeafs();

}

}

Page 24: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionvar Gardener = function(sprinkler, rake) {

this.sprinkler = sprinkler;

this.rake = rake;

};

Gardener.prototype.doGardening = function() {

this.sprinkler.waterFlowers();

this.rake.rakeFallenLeafs();

};

Page 25: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionimport {Sprinkler} from ‘./sprinkler’;

export class Gardener {

}

Page 26: Angular 2.0

import {Sprinker} from ‘./sprinkler’;

import {Rake} from ‘./rake’;

class Gardener {

constructor(sprinkler, rake) {

this.sprinkler = sprinkler;

this.rake = rake;

}

doGardening() {

this.sprinkler.waterFlowers();

this.rake.rakeFallenLeafs();

}

}

Page 27: Angular 2.0

import {Inject} from ‘di/annotations’;

import {Sprinker} from ‘./sprinkler’;

import {Rake} from ‘./rake’;

class Gardener {

constructor(@Inject(Sprinker) sprinkler,

@Inject(Rake) rake) {

this.sprinkler = sprinkler;

this.rake = rake;

}

doGardening() {

this.sprinkler.waterFlowers();

this.rake.rakeFallenLeafs();

}

}

Page 28: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionimport {bootstrap} from ‘angular2/angular2’

import {Gardener} from ‘./gardener’

import {Sprinkler} from ‘./sprinkler’

import {Rake} from ‘./Rake’

bootstrap(GardenerApp, [Gardener, Sprinker, Rake]);

Page 29: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionimport {Sprinkler} from ‘./gardener/sprinkler’;

class MockSprinkler {

waterFlowers() {

console.log(‘sprinkle sprinkle’);

}

}

Page 30: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionimport {Provide} from ‘di/annotations’;

import {Sprinkler} from ‘./gardener/sprinkler’;

@Provide(Sprinkler)

class MockSprinkler {

waterFlowers() {

console.log(‘sprinkle sprinkle’);

}

}

Page 31: Angular 2.0

Angular 2.0, whats the news?

Dependency Injectionimport {bootstrap} from ‘angular2/angular2’

import {Gardener} from ‘./gardener’

import {MockSprinker} from ‘./mocks/mockSprinkler’

import {Rake} from ‘./Rake’

bootstrap(GardenerApp, [Gardener, MockSprinker, Rake]);

Page 32: Angular 2.0

Angular 2.0, whats the news?

Components en templates

Application

Filters

Talk Talk

Talks

Page 33: Angular 2.0

@Component({

selector: 'talk-cmp',

properties: ['talk'],

events: ['rate']

})

@View({

directives: [FormattedRating, WatchButton, RateButton],

templateUrl: 'talk_cmp.html'

})

class TalkCmp {

talk: Talk;

rate: EventEmitter;

//...

}

Page 34: Angular 2.0

Angular 2.0, whats the news?

Components en templates{{talk.title}}

{{talk.speaker}}

<formatted-rating></formatted-rating><watch-button></

watch-button><rate-button></rate-button>

Page 35: Angular 2.0

Touch animations

Persistence

Angular 2.0, whats the news?

What else?

Page 36: Angular 2.0

Getting started with Angular 2.0

Page 37: Angular 2.0

In conclusion

Not finished

Some links: http://angular.iohttps://github.com/angular/router

Youtube:Victor Savkin ng-conf 2015 - Change detectionVojta Jina ng-conf 2014 - Dependency injection

Blogs:http://victorsavkin.com/post/110170125256/change-detection-in-angular-2http://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.htmlhttp://blog.thoughtram.io/angular/2015/05/18/dependency-injection-in-angular-2.html