SlideShare a Scribd company logo
1 of 64
Download to read offline
Angular를 활용한 웹 프론트단 개발과
2.0에서 달라진점
고재도
W3C HTML5 Conference 2015
+jeado.ko
haibane84@gmail.com
- “Bitfinder.co” Software Engineer
- “kt” IoT Platform Researcher
- “http://webframeworks.kr” AngularJS Tutorial Contributor
- “Google Developer Group Korea WebTech” Organizer
- “시작하세요 AngularJS wikibooks” Author
Change of Web Frontend
Library Feature-Complete
Framework
MVC
Framework
Component
component?
<select>
<input>
<ng-search-icon>
<ng-paper-fab>
<ng-drawer-panel>
<ng-field>
Component
= Building block (LEGO)
= a group of HTML elements
Component is made of two
main parts
- View
- Logic
Components View
<section>
<h4>{{ profile.name }}</h4>
<p> Age - {{ profile.age }}</p>
<button ng-click="save()">Save</button>
</section>
<profile-card profile="profile"></profile-card>
Reusable group of element
Component Logic
A Object/Function - A place to store properties and functions
function ProfileCardCtrl(){
this.profile = new Profile({ name : 'jay' });
this.save = function(){
// ...
}
}
So How ?
React Component
class HeloMessage extends React.Component {
render() {
return <div>Hello {this.props.name}</div>;
}
}
React.render(<HelloMessage name="Jay" />,
mountNode);
Ember Component
App.AppProfileComponent = Ember.Component.extend({
actions: {
hello: function(name) {
console.log("Hello", name);
}
}
});
<!-- app-profile template -->
<h1>{{person.title}}</h1>
<img src={{person.avatar}}>
<p class='signature'>{{person.signature}}</p>
{{app-profile person=currentUser}}
Polymer Component
//////// porot-element.html ////////
<link rel="import"
href="bower_components/polymer/polymer.html">
<script>
Polymer({
is: "proto-element",
ready: function() {
this.textContent = "I'm a proto-element."
}
});
</script>
//////// index.html ////////
</head>
<link rel="import" href="proto-element.html">
</head>
<body>
<proto-element></proto-element>
</body>
Angular Connect, London, October 2015
Angular 2.0
Angular Connect, London, October 2015
2.0.0-alpha.48 (2015-12-05)
My First Component
import {bootstrap, Component} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);
//index.html
<my-app>loading...</my-app>
Component
Template
Directive
Controller Component
ng1 ng2
Typescript
• Open Source project from Microsoft Technologies.
• An attempt to 'fix' the missing parts of JavaScript.
• A Superset of JavaScript => JavaScript + Static Types
(and Classes and Modules and more…).
• It uses ES6 syntax with Type Annotation and compiles to
plain JavaScript (target: ES3, ES5, ES6).
• Any valid JavaScript application is also a TypeScript
application
Typescript
tsc app.tsapp.ts app.js
TSC - the TypeScript compiler
TSD - TypeScript Definition Files package manager
TypeScript Definition File (ambient declaration file)
• .d.ts extension.
• Allows the definition of strong types.
• Provide type definition for external JavaScript libraries.
DefinitelyTyped (http://definitelytyped.org/): a community driven project on GitHub that tracks all of them.
Typescript
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
var greeter = new Greeter("world");
var button = document.createElement('button');
button.textContent = "Say Hello";
button.onclick = function() {
alert(greeter.greet());
}
document.body.appendChild(button);
Type Annotation
Typescript
import {bootstrap, Component} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);
Meta Annotation
ES5 Support
(function() {
var AppComponent = ng
.Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
.Class({
constructor: function () { }
});
document.addEventListener('DOMContentLoaded', function() {
ng.bootstrap(AppComponent);
});
})();
Language Support
ES5 ES6 TypeScript Dart
Language Support
CompileNo Compile
ES5 ES6 TypeScript Dart
Language Support
TypesNo Types
ES5 ES6 TypeScript Dart
Language Support
TypeScriptES6 Dart
No JS
TypeScriptES6
JavaScript-Based Syntax
ES5
Browser Support
How Fast?
Rendering Script Times
Re-rendering Script Times on Changes
Details at bit.ly/1RTFFWG
Tour of Heroes (before Dashboard)
File Structure
angular2-tour-of-heroes
├── node_modules
├── src
| ├── app
| | └── app.ts
| ├── index.html
| └── tsconfig.json
└── package.json
SystemJS Loader : index.js
<html>
<head>
<title>Tour of Heroes</title>
<script src="../node_modules/systemjs/dist/system.src.js"></script>
<script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
<script>
System.config({
packages: {'app': {defaultExtension: 'js'}}
});
System.import('app/app');
</script>
</head>
<body>
<my-app>loading...</my-app>
</body>
</html>
SystemJS Loader
angular2.js bundle (System.register)
Angular2
RxJS
Reflect.js
Zone.js
Application code
SystemJS loader
Define Hero Type - app.ts
class Hero {
id: number;
name: string;
}
Add few heroes - app.ts
var HEROES: Hero[] = [
{ "id": 11, "name": "Mr. Nice" },
{ "id": 12, "name": "Narco" },
{ "id": 13, "name": "Bombasto" },
{ "id": 14, "name": "Celeritas" },
{ "id": 15, "name": "Magneta" },
{ "id": 16, "name": "RubberMan" },
{ "id": 17, "name": "Dynama" },
{ "id": 18, "name": "Dr IQ" },
{ "id": 19, "name": "Magma" },
{ "id": 20, "name": "Tornado" }
];
ES6 Module load - app.ts
import {Component, bootstrap, NgFor} from 'angular2/angular2';
angular.module('app',[ ‘ng’, ‘.....’ ])
angular 1.x
Define AppComponet Using ES6 Class - app.ts
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
}
@component
@Component({
selector: 'my-app',
})
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
}
@Component({
selector: 'my-app',
template:`
<h1>{{title}}</h1>
<h2>My Heroes</h2>
<ul class="heroes">
<template ng-for #hero [ng-for-of]="heroes">
<li><span class="badge">{{hero.id}}</span> {{hero.name}}</li>
</template>
</ul>
`,
directives: [NgFor]
})
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
}
template
@Component({
selector: 'my-app',
template:`
<h1>{{title}}</h1>
<h2>My Heroes</h2>
<ul class="heroes">
<li *ng-for="#hero of heroes" (click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
</ul>
`,
directives: [NgFor]
})
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
}
template
Bootstrap
bootstrap(AppComponent);
Add Encapsulation Style to Component
@Component({
selector: 'my-app',
template:`
...
`,
styles:[`
.heroes {list-style-type: none; margin-left: 1em; padding: 0; width: 10em;}
.heroes li { cursor: pointer; position: relative; left: 0; transition: all 0.2s ease; }
.heroes li:hover {color: #369; background-color: #EEE; left: .2em;}
.heroes .badge {
font-size: small;
color: white;
padding: 0.1em 0.7em;
background-color: #369;
line-height: 1em;
position: relative;
left: -1px;
top: -1px;
}
.selected { background-color: #EEE; color: #369; }
`],
directives: [NgFor]
})
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
}
Three way to add style
● Component inline styles
● Styles urls
● Template inline styles
Add Style to Component - Styles urls
@Component({
selector: 'my-app',
template:`
<h1>{{title}}</h1>
<h2>My Heroes</h2>
<ul class="heroes">
<li *ng-for="#hero of heroes">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
</ul>
`,
styleUrls : ['app.css'],
directives: [NgFor]
})
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
}
Add Style to Component - Template inline styles
@Component({
selector: 'my-app',
template:`
<style>
.heroes {list-style-type: none; margin-left: 1em; padding: 0; width: 10em;}
.heroes li { cursor: pointer; position: relative; left: 0; transition: all 0.2s ease; }
.heroes li:hover {color: #369; background-color: #EEE; left: .2em;}
.heroes .badge {
font-size: small;
color: white;
padding: 0.1em 0.7em;
background-color: #369;
line-height: 1em;
position: relative;
left: -1px;
top: -1px;
}
.selected { background-color: #EEE; color: #369;
</style>
….
`,
directives: [NgFor]
})
Emulated View Encapsulation
Using Shadow Dom
import {Component, bootstrap, NgFor, ViewEncapsulation} from 'angular2/angular2';
@Component({
selector: 'my-app',
template:`
<h1>{{title}}</h1>
<h2>My Heroes</h2>
<ul class="heroes">
<li *ng-for="#hero of heroes" (click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
</ul>
`,
styles:[`
….
`],
directives: [NgFor],
encapsulation : ViewEncapsulation.Native
})
Add event binding
<h1>{{title}}</h1>
<h2>My Heroes</h2>
<ul class="heroes">
<li *ng-for="#hero of heroes" (click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
</ul>
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
public selectedHero: Hero;
onSelect(hero: Hero) { this.selectedHero = hero; }
}
Two-way Data binding
<div *ng-if="selectedHero">
<h2>{{selectedHero.name}} details!</h2>
<div><label>id: </label>{{selectedHero.id}}</div>
<div>
<label>name: </label>
<input [(ng-model)]="selectedHero.name" placeholder="name"></input>
</div>
</div>
Data Binding in template
ng-class
<li *ng-for="#hero of heroes" [ng-class]="getSelectedClass(hero)" (click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
class AppComponent {
public title = 'Tour of Heroes';
public heroes = HEROES;
public selectedHero: Hero;
onSelect(hero: Hero) { this.selectedHero = hero; }
getSelectedClass(hero: Hero) {
return { 'selected': hero === this.selectedHero };
}
}
References
- https://angular.io/
- AngularConnect Keynote 2015
- ngVegas The Angular 2 Glossary
- TRY Angular 2
- View Encapsulation in Angular 2
- http://info.meteor.com/blog/comparing-performance-of-blaze-react-angular-
meteor-and-angular-2-with-meteor
Thanks you
QnA

More Related Content

What's hot

Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverIntroducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
Spike Brehm
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
Wei Ru
 

What's hot (20)

AngularJS: an introduction
AngularJS: an introductionAngularJS: an introduction
AngularJS: an introduction
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
AngularJS
AngularJSAngularJS
AngularJS
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverIntroducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 
Workshop 27: Isomorphic web apps with ReactJS
Workshop 27: Isomorphic web apps with ReactJSWorkshop 27: Isomorphic web apps with ReactJS
Workshop 27: Isomorphic web apps with ReactJS
 
Nicolas Embleton, Advanced Angular JS
Nicolas Embleton, Advanced Angular JSNicolas Embleton, Advanced Angular JS
Nicolas Embleton, Advanced Angular JS
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
 
AngularJS Framework
AngularJS FrameworkAngularJS Framework
AngularJS Framework
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular js
 

Viewers also liked

[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민
[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민
[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민
NAVER D2
 
JavaScript 프레임워크 살펴보기
JavaScript 프레임워크 살펴보기JavaScript 프레임워크 살펴보기
JavaScript 프레임워크 살펴보기
항희 이
 

Viewers also liked (20)

Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까
 
Angular2를 활용한 컴포넌트 중심의 개발
Angular2를 활용한 컴포넌트 중심의 개발Angular2를 활용한 컴포넌트 중심의 개발
Angular2를 활용한 컴포넌트 중심의 개발
 
Angular2 가기전 Type script소개
 Angular2 가기전 Type script소개 Angular2 가기전 Type script소개
Angular2 가기전 Type script소개
 
Angularjs 도입 선택 가이드
Angularjs 도입 선택 가이드Angularjs 도입 선택 가이드
Angularjs 도입 선택 가이드
 
AngularJS 2, version 1 and ReactJS
AngularJS 2, version 1 and ReactJSAngularJS 2, version 1 and ReactJS
AngularJS 2, version 1 and ReactJS
 
Front end dev 2016 & beyond
Front end dev 2016 & beyondFront end dev 2016 & beyond
Front end dev 2016 & beyond
 
Angular2를 위한 컴포넌트 분석과 개발
Angular2를 위한 컴포넌트 분석과 개발Angular2를 위한 컴포넌트 분석과 개발
Angular2를 위한 컴포넌트 분석과 개발
 
기술용어 선호도 조사 결과
기술용어 선호도 조사 결과기술용어 선호도 조사 결과
기술용어 선호도 조사 결과
 
현실적 PWA
현실적 PWA현실적 PWA
현실적 PWA
 
Angular2를 위한 타입스크립트
Angular2를 위한 타입스크립트Angular2를 위한 타입스크립트
Angular2를 위한 타입스크립트
 
[XECon+PHPFest 2014] jQuery 개발자에서 AngularJS 개발자 되기
[XECon+PHPFest 2014] jQuery 개발자에서 AngularJS 개발자 되기[XECon+PHPFest 2014] jQuery 개발자에서 AngularJS 개발자 되기
[XECon+PHPFest 2014] jQuery 개발자에서 AngularJS 개발자 되기
 
[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민
[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민
[125]react로개발자2명이플랫폼4개를서비스하는이야기 심상민
 
Angular js 2.0 preview
Angular js 2.0 previewAngular js 2.0 preview
Angular js 2.0 preview
 
진보한 개발 환경에서 품질 좋은 코드 생산 (WebStorm)
진보한 개발 환경에서 품질 좋은 코드 생산 (WebStorm)진보한 개발 환경에서 품질 좋은 코드 생산 (WebStorm)
진보한 개발 환경에서 품질 좋은 코드 생산 (WebStorm)
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6
 
Angular2 NgModule
Angular2   NgModuleAngular2   NgModule
Angular2 NgModule
 
JavaScript 프레임워크 살펴보기
JavaScript 프레임워크 살펴보기JavaScript 프레임워크 살펴보기
JavaScript 프레임워크 살펴보기
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 

Similar to Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점

前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
Ting Lv
 

Similar to Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 (20)

Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
Get together on getting more out of typescript &amp; angular 2
Get together on getting more out of typescript &amp; angular 2Get together on getting more out of typescript &amp; angular 2
Get together on getting more out of typescript &amp; angular 2
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 
A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
 
Heroku pop-behind-the-sense
Heroku pop-behind-the-senseHeroku pop-behind-the-sense
Heroku pop-behind-the-sense
 
Web components with Angular
Web components with AngularWeb components with Angular
Web components with Angular
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
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
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
 
Aprimorando sua Aplicação com Ext JS 4 - BrazilJS
Aprimorando sua Aplicação com Ext JS 4 - BrazilJSAprimorando sua Aplicação com Ext JS 4 - BrazilJS
Aprimorando sua Aplicação com Ext JS 4 - BrazilJS
 
Pengenalan AngularJS
Pengenalan AngularJSPengenalan AngularJS
Pengenalan AngularJS
 
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
 

Recently uploaded

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점

  • 1. Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 고재도 W3C HTML5 Conference 2015
  • 2. +jeado.ko haibane84@gmail.com - “Bitfinder.co” Software Engineer - “kt” IoT Platform Researcher - “http://webframeworks.kr” AngularJS Tutorial Contributor - “Google Developer Group Korea WebTech” Organizer - “시작하세요 AngularJS wikibooks” Author
  • 3. Change of Web Frontend Library Feature-Complete Framework MVC Framework Component
  • 5.
  • 6.
  • 10. Component = Building block (LEGO) = a group of HTML elements
  • 11. Component is made of two main parts - View - Logic
  • 12. Components View <section> <h4>{{ profile.name }}</h4> <p> Age - {{ profile.age }}</p> <button ng-click="save()">Save</button> </section> <profile-card profile="profile"></profile-card> Reusable group of element
  • 13. Component Logic A Object/Function - A place to store properties and functions function ProfileCardCtrl(){ this.profile = new Profile({ name : 'jay' }); this.save = function(){ // ... } }
  • 14. So How ? React Component class HeloMessage extends React.Component { render() { return <div>Hello {this.props.name}</div>; } } React.render(<HelloMessage name="Jay" />, mountNode); Ember Component App.AppProfileComponent = Ember.Component.extend({ actions: { hello: function(name) { console.log("Hello", name); } } }); <!-- app-profile template --> <h1>{{person.title}}</h1> <img src={{person.avatar}}> <p class='signature'>{{person.signature}}</p> {{app-profile person=currentUser}} Polymer Component //////// porot-element.html //////// <link rel="import" href="bower_components/polymer/polymer.html"> <script> Polymer({ is: "proto-element", ready: function() { this.textContent = "I'm a proto-element." } }); </script> //////// index.html //////// </head> <link rel="import" href="proto-element.html"> </head> <body> <proto-element></proto-element> </body>
  • 15. Angular Connect, London, October 2015 Angular 2.0
  • 16. Angular Connect, London, October 2015 2.0.0-alpha.48 (2015-12-05)
  • 17. My First Component import {bootstrap, Component} from 'angular2/angular2'; @Component({ selector: 'my-app', template: '<h1>My First Angular 2 App</h1>' }) class AppComponent { } bootstrap(AppComponent); //index.html <my-app>loading...</my-app>
  • 19. Typescript • Open Source project from Microsoft Technologies. • An attempt to 'fix' the missing parts of JavaScript. • A Superset of JavaScript => JavaScript + Static Types (and Classes and Modules and more…). • It uses ES6 syntax with Type Annotation and compiles to plain JavaScript (target: ES3, ES5, ES6). • Any valid JavaScript application is also a TypeScript application
  • 20. Typescript tsc app.tsapp.ts app.js TSC - the TypeScript compiler TSD - TypeScript Definition Files package manager TypeScript Definition File (ambient declaration file) • .d.ts extension. • Allows the definition of strong types. • Provide type definition for external JavaScript libraries. DefinitelyTyped (http://definitelytyped.org/): a community driven project on GitHub that tracks all of them.
  • 21. Typescript class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } var greeter = new Greeter("world"); var button = document.createElement('button'); button.textContent = "Say Hello"; button.onclick = function() { alert(greeter.greet()); } document.body.appendChild(button); Type Annotation
  • 22. Typescript import {bootstrap, Component} from 'angular2/angular2'; @Component({ selector: 'my-app', template: '<h1>My First Angular 2 App</h1>' }) class AppComponent { } bootstrap(AppComponent); Meta Annotation
  • 24. (function() { var AppComponent = ng .Component({ selector: 'my-app', template: '<h1>My First Angular 2 App</h1>' }) .Class({ constructor: function () { } }); document.addEventListener('DOMContentLoaded', function() { ng.bootstrap(AppComponent); }); })();
  • 25. Language Support ES5 ES6 TypeScript Dart
  • 27. Language Support TypesNo Types ES5 ES6 TypeScript Dart
  • 28. Language Support TypeScriptES6 Dart No JS TypeScriptES6 JavaScript-Based Syntax ES5
  • 31.
  • 35. Tour of Heroes (before Dashboard)
  • 36. File Structure angular2-tour-of-heroes ├── node_modules ├── src | ├── app | | └── app.ts | ├── index.html | └── tsconfig.json └── package.json
  • 37. SystemJS Loader : index.js <html> <head> <title>Tour of Heroes</title> <script src="../node_modules/systemjs/dist/system.src.js"></script> <script src="../node_modules/angular2/bundles/angular2.dev.js"></script> <script> System.config({ packages: {'app': {defaultExtension: 'js'}} }); System.import('app/app'); </script> </head> <body> <my-app>loading...</my-app> </body> </html>
  • 38. SystemJS Loader angular2.js bundle (System.register) Angular2 RxJS Reflect.js Zone.js Application code SystemJS loader
  • 39. Define Hero Type - app.ts class Hero { id: number; name: string; }
  • 40. Add few heroes - app.ts var HEROES: Hero[] = [ { "id": 11, "name": "Mr. Nice" }, { "id": 12, "name": "Narco" }, { "id": 13, "name": "Bombasto" }, { "id": 14, "name": "Celeritas" }, { "id": 15, "name": "Magneta" }, { "id": 16, "name": "RubberMan" }, { "id": 17, "name": "Dynama" }, { "id": 18, "name": "Dr IQ" }, { "id": 19, "name": "Magma" }, { "id": 20, "name": "Tornado" } ];
  • 41. ES6 Module load - app.ts import {Component, bootstrap, NgFor} from 'angular2/angular2'; angular.module('app',[ ‘ng’, ‘.....’ ]) angular 1.x
  • 42. Define AppComponet Using ES6 Class - app.ts class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; }
  • 43. @component @Component({ selector: 'my-app', }) class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; }
  • 44. @Component({ selector: 'my-app', template:` <h1>{{title}}</h1> <h2>My Heroes</h2> <ul class="heroes"> <template ng-for #hero [ng-for-of]="heroes"> <li><span class="badge">{{hero.id}}</span> {{hero.name}}</li> </template> </ul> `, directives: [NgFor] }) class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; } template
  • 45. @Component({ selector: 'my-app', template:` <h1>{{title}}</h1> <h2>My Heroes</h2> <ul class="heroes"> <li *ng-for="#hero of heroes" (click)="onSelect(hero)"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> </ul> `, directives: [NgFor] }) class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; } template
  • 47.
  • 48. Add Encapsulation Style to Component @Component({ selector: 'my-app', template:` ... `, styles:[` .heroes {list-style-type: none; margin-left: 1em; padding: 0; width: 10em;} .heroes li { cursor: pointer; position: relative; left: 0; transition: all 0.2s ease; } .heroes li:hover {color: #369; background-color: #EEE; left: .2em;} .heroes .badge { font-size: small; color: white; padding: 0.1em 0.7em; background-color: #369; line-height: 1em; position: relative; left: -1px; top: -1px; } .selected { background-color: #EEE; color: #369; } `], directives: [NgFor] }) class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; }
  • 49. Three way to add style ● Component inline styles ● Styles urls ● Template inline styles
  • 50. Add Style to Component - Styles urls @Component({ selector: 'my-app', template:` <h1>{{title}}</h1> <h2>My Heroes</h2> <ul class="heroes"> <li *ng-for="#hero of heroes"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> </ul> `, styleUrls : ['app.css'], directives: [NgFor] }) class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; }
  • 51. Add Style to Component - Template inline styles @Component({ selector: 'my-app', template:` <style> .heroes {list-style-type: none; margin-left: 1em; padding: 0; width: 10em;} .heroes li { cursor: pointer; position: relative; left: 0; transition: all 0.2s ease; } .heroes li:hover {color: #369; background-color: #EEE; left: .2em;} .heroes .badge { font-size: small; color: white; padding: 0.1em 0.7em; background-color: #369; line-height: 1em; position: relative; left: -1px; top: -1px; } .selected { background-color: #EEE; color: #369; </style> …. `, directives: [NgFor] })
  • 52.
  • 54. Using Shadow Dom import {Component, bootstrap, NgFor, ViewEncapsulation} from 'angular2/angular2'; @Component({ selector: 'my-app', template:` <h1>{{title}}</h1> <h2>My Heroes</h2> <ul class="heroes"> <li *ng-for="#hero of heroes" (click)="onSelect(hero)"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> </ul> `, styles:[` …. `], directives: [NgFor], encapsulation : ViewEncapsulation.Native })
  • 55.
  • 56. Add event binding <h1>{{title}}</h1> <h2>My Heroes</h2> <ul class="heroes"> <li *ng-for="#hero of heroes" (click)="onSelect(hero)"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> </ul> class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; public selectedHero: Hero; onSelect(hero: Hero) { this.selectedHero = hero; } }
  • 57. Two-way Data binding <div *ng-if="selectedHero"> <h2>{{selectedHero.name}} details!</h2> <div><label>id: </label>{{selectedHero.id}}</div> <div> <label>name: </label> <input [(ng-model)]="selectedHero.name" placeholder="name"></input> </div> </div>
  • 58. Data Binding in template
  • 59.
  • 60. ng-class <li *ng-for="#hero of heroes" [ng-class]="getSelectedClass(hero)" (click)="onSelect(hero)"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> class AppComponent { public title = 'Tour of Heroes'; public heroes = HEROES; public selectedHero: Hero; onSelect(hero: Hero) { this.selectedHero = hero; } getSelectedClass(hero: Hero) { return { 'selected': hero === this.selectedHero }; } }
  • 61.
  • 62.
  • 63. References - https://angular.io/ - AngularConnect Keynote 2015 - ngVegas The Angular 2 Glossary - TRY Angular 2 - View Encapsulation in Angular 2 - http://info.meteor.com/blog/comparing-performance-of-blaze-react-angular- meteor-and-angular-2-with-meteor