67
한한한 [email protected] han41858.tistory.com : 어어어어 어어어 ngular 2

Angular 2 어디까지 왔을까

  • Upload
    -

  • View
    3.124

  • Download
    10

Embed Size (px)

Citation preview

Page 1: Angular 2 어디까지 왔을까

한장현[email protected]

: 어디까지 왔을까

ngular 2

Page 2: Angular 2 어디까지 왔을까

2

OAngular 2 진행상황

Angular 2 의 장애물

Angular 1 대비 장점 XAngular 1업그레이드 방법

다른 라이브러리와 비교

Today

Page 3: Angular 2 어디까지 왔을까

3

Ver. 2.2.0

ngular 2

Page 4: Angular 2 어디까지 왔을까

4

{

"name": "angular-quickstart",

"version": "1.0.0",

"scripts": {

"start": "npm run lite",

"lite": "lite-server"

},

"licenses": [

{

"type": "MIT",

"url": "https://github.com/angular/angular.io/blob/mas-ter/LICENSE"

}

],

"devDependencies": {

"concurrently": "^3.0.0",

"lite-server": "^2.2.2"

}

}

"dependencies": {

"@angular/common": "~2.1.1",

"@angular/compiler": "~2.1.1",

"@angular/core": "~2.1.1",

"@angular/forms": "~2.1.1",

"@angular/http": "~2.1.1",

"@angular/platform-browser": "~2.1.1",

"@angular/platform-browser-dynamic": "~2.1.1",

"@angular/router": "~3.1.1",

"@angular/upgrade": "~2.1.1",

"angular-in-memory-web-api": "~0.1.5",

"core-js": "^2.4.1",

"reflect-metadata": "^0.1.8",

"rxjs": "5.0.0-beta.12",

"zone.js": "^0.6.25"

},

Quickstart package.j-son

2.0.0 package.json

Page 5: Angular 2 어디까지 왔을까

5

[Major] . [Minor] . [Patch]버그 수정

호환되지 않는 API 변화호환되면서 기능 변경 , 추가

SemVer

http://han41858.tistory.com/22

Page 6: Angular 2 어디까지 왔을까

6

→ 빠르고 지속적인 큰 변화①장애물

Page 7: Angular 2 어디까지 왔을까

7

2016. 12. 1 출판 예정

2016. 10. 1 출판 목표

빠른 변화

Page 8: Angular 2 어디까지 왔을까

8

CHANGELOG.mdAngular 2 진행 상황

Page 9: Angular 2 어디까지 왔을까

9

ngModule

CLIAngular 2 Final

Page 10: Angular 2 어디까지 왔을까

10

→ 새로운 개발 언어②장애물

Page 11: Angular 2 어디까지 왔을까

11

Angular 2 개발 언어

Page 12: Angular 2 어디까지 왔을까

12

ts

js

dart

https://angular.io/docs/ /latest/quickstart.html

Page 14: Angular 2 어디까지 왔을까

14

AtScript

ES5

ES6

TypeScript

Annotations

Page 15: Angular 2 어디까지 왔을까

15

AtScript in Reality

ES5

ES6

TypeScript

Annotations

Page 16: Angular 2 어디까지 왔을까

16

TypeScript 1.5+

ES5

ES6

Types

Annotations

Page 17: Angular 2 어디까지 왔을까

17

All of the learnings we have gained

in building AngularDart, will be ap-

plied back to AngularJS v2.

Page 18: Angular 2 어디까지 왔을까

18

Page 19: Angular 2 어디까지 왔을까

19

Page 20: Angular 2 어디까지 왔을까

20

(function(app) { app.AppComponent = ng.core.Component({ selector: 'my-app', template: '<h1>My First Angular App</h1>' }) .Class({ constructor: function() {} });})(window.app || (window.app = {}));

JavaScript

import 'package:angular2/core.dart';

@Component( selector: 'my-app', template: '<h1>My First Angular App</h1>')

export class AppComponent {}

Dart

import { Component } from '@angular/core';

@Component({ selector: 'my-app', template: '<h1>My First Angular App</h1>'})

export class AppComponent {}

Type-Script

언어 비교 - Component

Page 21: Angular 2 어디까지 왔을까

21

(function(app) { app.AppModule = ng.core.NgModule({ imports: [ ng.platformBrowser.BrowserModule ], declarations: [ app.AppComponent ], bootstrap: [ app.AppComponent ] }) .Class({ constructor: function() {} });})(window.app || (window.app = {}));

JavaScript

-- This page is not yet available in Dart. We recommend reading it in TypeScript. --

Dart

import { NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { AppComponent } from './app.component';

@NgModule({ imports: [ BrowserModule ], declarations: [ AppComponent ], bootstrap: [ AppComponent ]})

export class AppModule { }

Type-Script

언어 비교 - ngModule

Page 22: Angular 2 어디까지 왔을까

22

(function(app) { document.addEventListener('DOMContentLoaded', function() { ng.platformBrowserDynamic .platformBrowserDynamic() .bootstrapModule(app.AppModule); });})(window.app || (window.app = {}));

JavaScript

import 'package:angular2/platform/browser.dart';import 'package:angular2_quickstart/app_component.dart';

void main() { bootstrap(AppComponent);}

Dart

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';import { AppModule } from './app.module';

const platform = platformBrowserDynamic();platform.bootstrapModule(AppModule);

Type-Script

언어 비교 - bootstrap

Page 23: Angular 2 어디까지 왔을까

23

→ 새로운 Tool, 개발 방식의 변화

③장애물

Page 24: Angular 2 어디까지 왔을까

24

26%22%17%35%

Environment Setup

Too Complicated

Lack of Documentation

Other Interests

Mike BrocchiAngular CLI contributor

Q. What is/was your largest barrier to getting started with Angular 2?

with Angular CLI

Page 25: Angular 2 어디까지 왔을까

25

Page 26: Angular 2 어디까지 왔을까

26

IDE

Build, Bundling

Test

IDE

Page 27: Angular 2 어디까지 왔을까

27

Boilerplate MakingComponents Build Running ServerUnit /

End-to-end Test Deploy

CLI 활용 영역

npmgeneratorYeomanmean.js

IDE

gulpgrunt

webpack

node.jslite-server

webpack-dev-servermochakarma

gitAWS-cli

Angular CLI

Page 29: Angular 2 어디까지 왔을까

29

Buildng build

New Projectng new PROJECT_NAMEcd PROJECT_NAMEng serve (http://localhost:4200/)

Unit test, end-to-end testng testng e2e

deploy via GitHubng github-pages:deploy --message "Optional commit message"

CLI 사용 방법

Page 30: Angular 2 어디까지 왔을까

30

Make Components

CLI 사용 방법

Page 31: Angular 2 어디까지 왔을까

31

{ "name": "cli-test", "version": "0.0.0", "license": "MIT", "angular-cli": {}, "scripts": { "start": "ng serve", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "~2.0.0", "@angular/compiler": "~2.0.0", "@angular/core": "~2.0.0", "@angular/forms": "~2.0.0", "@angular/http": "~2.0.0", "@angular/platform-browser": "~2.0.0", "@angular/platform-browser-dynamic": "~2.0.0", "@angular/router": "~3.0.0", "core-js": "^2.4.1", "rxjs": "5.0.0-beta.12", "ts-helpers": "^1.1.1", "zone.js": "^0.6.23" }, "devDependencies": { "@types/jasmine": "^2.2.30", "@types/node": "^6.0.42", "angular-cli": "1.0.0-beta.17", "codelyzer": "~0.0.26", "jasmine-core": "2.4.1", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "4.0.9", "ts-node": "1.2.1", "tslint": "3.13.0", "typescript": "2.0.2" }}

ng new

Page 32: Angular 2 어디까지 왔을까

32

ng serve

Page 33: Angular 2 어디까지 왔을까

33

Angular CLI Demo

Page 34: Angular 2 어디까지 왔을까

34

CLI Roadmap

• Offline template compilation• Lazy loading routes• 3rd party add-ons (build, deploy)• Angular upgrades• Continuous integration• Product angular packages• More customizations

Page 35: Angular 2 어디까지 왔을까

35

→ 문법의 변화작은 장애물

Page 36: Angular 2 어디까지 왔을까

36

Directive in Angular 2

Page 37: Angular 2 어디까지 왔을까

37

Data binding

Page 38: Angular 2 어디까지 왔을까

38

* and <template>

<hero-detail *ngIf="currentHero" [hero]="currentHero"></hero_detail>

<hero-detail *ngFor="let hero of heroes; trackBy:trackByHeroes" [hero]="hero"></hero-detail>

<span [ngSwitch]="toeChoice">

<span *ngSwitchCase="'Eenie'">Eenie</span>

<span *ngSwitchCase="'Meanie'">Meanie</span>

<span *ngSwitchCase="'Miney'">Miney</span>

<span *ngSwitchCase="'Moe'">Moe</span>

<span *ngSwitchDefault>other</span>

</span>

Page 39: Angular 2 어디까지 왔을까

39

import {Component} from '@angular/core'import {MdButtonModule} from '@angular-material2/button'import {MdSideNavModule} from '@angular-material2/sidenav'import {MdCardModule} from '@angular-material2/card'import {RouterModule} from '@angular/router'

@NgModule({ imports: [ MdButtonModule, MdSideNavModule, MdCardModule, RouterModule.forRoot(routeConfig) ]})

class MyAppModule {}

import {Component} from '@angular/core'import {MD_BUTTON_DIRECTIVES} from '@angular-material2/button'import {MD_SIDENAV_DIRECTIVES} from '@angular-material2/sidenav'import {MD_CARD_DIRECTIVES} from '@angular-material2/card'import {provideRouter, ROUTER_DIRECTIVES} from '@angular/router'

@Component({ selector: 'my-component', providers: [ provideRouter(routeConfig) ], directives: [ MD_BUTTON_DIRECTIVES, MD_SIDENAV_DIRECTIVES, MD_CARD_DIRECTIVES, ROUTER_DIRECTIVES ]})class MyComponent {}

@ngModule

Page 40: Angular 2 어디까지 왔을까

40

@angular/core

Components

HTML Elements

@angular/core

Components

ngModule

HTML Elements

@ngModulebefore after

Page 41: Angular 2 어디까지 왔을까

41

→ 속도장점 ①

Page 42: Angular 2 어디까지 왔을까

42

https://www.youtube.com/watch?v=XQM0K6YG18s16:21~17:10

Page 43: Angular 2 어디까지 왔을까

43

But!!

Page 44: Angular 2 어디까지 왔을까

44

Page 45: Angular 2 어디까지 왔을까

45

https://www.youtube.com/watch?v=XQM0K6YG18s17:39~18:48

Page 46: Angular 2 어디까지 왔을까

46

new change detection :

zone.js

smoother virtual scrolling

smoother view transition

lazy loading

server-side rendering

첫 로딩은 2.5 배

리렌더링은 4.2 배

성능 개선 후 언제나 5 배 이상

?

Angular 1 대비

Page 47: Angular 2 어디까지 왔을까

47

Angular 1.4+1.2 1.3 1.4 1.54.13 4.545 0.100 0.0956.32 10.335 0.125 0.1254.2 5.715 0.140 0.1

10.075 4.65 0.105 0.1654.325 6.026 0.207 0.11510.8 7.92 0.160 0.165

12.85 11.52 0.120 0.2355.605 7.3 0.350 0.1

28.305 14.93 0.180 0.1511.5 9.395 0.100 0.176.35 5.895 0.100 0.1

6.315 10.24 0.110 0.259.01 7.2 0.115 0.1

3.665 13.315 0.150 0.1155.12 5.245 0.100 0.1658.03 6.025 0.495 0.23

6.445 12.645 0.115 0.148.015 6.085 0.100 0.1959.365 4.16 0.110 0.1656.89 14.645 0.115 0.105

Zackary ChappleSW Architect at CareerBuilder

1.2 1.3 1.4 1.5

90%+

8.36575 8.38955 0.15485 0.14925

Page 48: Angular 2 어디까지 왔을까

48

Deep tree : Speed

8.58

3.11

1.441

Baseline Angular 2with

View Cache

Angular 2 Angular 1.30

1

2

3

4

5

6

7

8

9

10

Page 49: Angular 2 어디까지 왔을까

49

Deep tree : Memory

9.53

2.56

1.161

Baseline Angular 2with

View Cache

Angular 2 Angular 1.30

1

2

3

4

5

6

7

8

9

10

Page 50: Angular 2 어디까지 왔을까

50

2000

1500

1000

500

02 9 16 23 30

# of tables

Angular 1

Angular 2

Angular 2(Immutable Data)

Virtual Scrolling Table

Tim

e

Page 51: Angular 2 어디까지 왔을까

51

JS frameworks benchmark

Page 52: Angular 2 어디까지 왔을까

52

2.31

1.69

1

1.6

1

2

3

0

4

5

6

7

8

9

create 1,000 rows

Angular v.1.5.8 Angular v.2.0.0-rc5 VanillaJS React

replace 1,000 rows create 10,000 rows 10,000 + 1,000 clear 10,000 rows

4.38

3.32

1

3.54

21.59

11.52

3.67

2.86

11.43

8.5

1.69

1

2.36

Page 53: Angular 2 어디까지 왔을까

53

→ 체계적인 개발 방법장점 ②

Page 54: Angular 2 어디까지 왔을까

54

지향점

• Mobile oriented• Modern browsers only• TypeScript• Dynamic loading, Server-side rendering• controller, $scope ⇒ component (directive + template)• RxJS 지원 , Reactive programming• Testing

• Angular Material 2• WebWorkers

Page 55: Angular 2 어디까지 왔을까

55

• A Google Chrome Dev Tools extension for debugging Angular 2 applications.

Augury

Page 56: Angular 2 어디까지 왔을까

56

not just a debugger

• Component Relationships

• Detailed Component Info

• Dependency Hierarchy

• Change Detection Strategy

• Editable Component Properties

• Router StructureVanessa Yuen

Augury contributor

Page 57: Angular 2 어디까지 왔을까

57

Page 58: Angular 2 어디까지 왔을까

58

Page 59: Angular 2 어디까지 왔을까

59

Augury Demo

Page 60: Angular 2 어디까지 왔을까

60

ngular 2써야 할까 ?언제 ?

Page 61: Angular 2 어디까지 왔을까

61

Productivity

Page 62: Angular 2 어디까지 왔을까

62

체계적인 프로젝트 관리

최신 기술의 자연스러운 도입

Page 63: Angular 2 어디까지 왔을까

63

더 나은 길로 가고 있다 .

사용은 아직… .

관심을 계속 갖자 .

Page 64: Angular 2 어디까지 왔을까

64

Q & A

Page 65: Angular 2 어디까지 왔을까

65

세상에 라이브러리는 많다 .

Page 66: Angular 2 어디까지 왔을까

66

Angular 2 의 선구자가 될 시점은 지금 !

Page 67: Angular 2 어디까지 왔을까

67

감사합니다 [email protected]

han41858.tistory.com