Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Angular 2.0 - What to Expect?
Search
Allan Marques Baptista
January 15, 2015
Programming
0
240
Angular 2.0 - What to Expect?
A talk from a GDG meeting at Rio de Janeiro, Brazil.
Allan Marques Baptista
January 15, 2015
Tweet
Share
More Decks by Allan Marques Baptista
See All by Allan Marques Baptista
Hybrid Apps - From web to mobile without pain
m4n3z40
0
52
Other Decks in Programming
See All in Programming
Python札幌 LT資料
t3tra
6
1k
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
140
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
110
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
880
認証・認可の基本を学ぼう前編
kouyuume
0
260
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
2
500
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
520
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
400
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
120
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
これならできる!個人開発のすゝめ
tinykitten
PRO
0
120
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
150
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.7k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Thoughts on Productivity
jonyablonski
73
5k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
30 Presentation Tips
portentint
PRO
1
170
HDC tutorial
michielstock
0
260
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
0
62
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
72
WENDY [Excerpt]
tessaabrams
8
35k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
120
Exploring anti-patterns in Rails
aemeredith
2
200
Transcript
Angular 2.0 What to expect?
Who is Allan Baptista?
Mobile Developer Hotel Urbano Participated on the latest desktop’s home
re-design Currently working on the 2.0 App for WP. M. Site’s Creator //WhoisAllanBaptista?
//WhoisAllanBaptista? Mobile Developer Hotel Urbano PHP HTML CSS JS Python
Ruby NodeJS Mobile Platforms
Who is Allan Baptista? Why 2.0?
ANGULAR //Why2.0 THEWEBIS AT A RIDICULOUS changing PACE HASGOTTOKEEPUP ES6
ES7
WTF is atScript?
//WTFisatScript? ES6 Type annotations Field annotations Metadata annotations Type introspection
+ + + +
import {Component} from 'angular'; import {Server} from './server'; @Component({selector: 'foo'})
export class MyComponent { constructor(server:Server) { this.server = server; } } import * as rtts from 'rtts'; import {Component} from 'angular'; import {Server} from './server'; export class MyComponent { constructor(server) { rtts.types(server, Server); this.server = server; } } MyComponent.parameters = [{is:Server}]; MyComponent.annotate = [ new Component({selector: 'foo'}) ]; ATSCRIPT AFTERCOMPILED //WTFisatScript?
Dependency Injection
scope management (all instances are singleton) someModule.controller('MyController', function($scope, greeter) {
// ... }); // or... angular.module('myModule', []) .factory('serviceId', ['depService', function(depService) { // ... }]) .directive('directiveName', ['depService', function(depService) { // ... }]) .filter('filterName', ['depService', function(depService) { // ... }]); // or... var MyController = function($scope, greeter) { // ... } MyController.$inject = ['$scope', 'greeter']; someModule.controller('MyController', MyController); //DependencyInjection PRESENT KNOWNPROBLEM
Enables a unique instance for every injection Providers, Lazy Injection,
Async Injections import {Component} from 'angular'; import {Server} from './server'; @Component({selector: 'foo'}) export class MyComponent { constructor(server:Server) { this.server = server; } } @TransientScope export class MyClass { ... } //DependencyInjection FUTURE ANDMORE
Components & Databinding
The Directive Definition Object (DDO) is awfully confusing and hard
to learn. angular.module('docsTabsExample', []) .directive('myPane', function() { return { require: ['^myTabs', '^ngModel'], restrict: 'E', transclude: true, scope: { title: '@' }, link: function(scope, element, attrs, controllers) { var tabsCtrl = controllers[0], modelCtrl = controllers[1]; tabsCtrl.addPane(scope); }, templateUrl: 'my-pane.html' }; }); <my-pane></my-pane> //Components&Databinding PRESENT KNOWNPROBLEM
//Components&Databinding FUTURE @ComponentDirective Creates a custom component composed of a
view and a controller. @DecoratorDirective Decorates an existing HTML element with additional behavior. @TemplateDirective Transforms HTML into a reusable template.
@ComponentDirective({ selector:'tab-container', directives:[NgRepeat] }) export class TabContainer { constructor(panes:Query<Pane>) {
this.panes = panes; } select(selectedPane:Pane) { //... } } <template> <div class="border"> <div class="tabs"> <div [ng-repeat|pane]="panes" class="tab" (^click)="select(pane)"> <img [src]=“pane.icon"> <span>${pane.name}</span> </div> </div> <content></content> </div> </template> //Components&Databinding @ComponentDirective
@DecoratorDirective({ selector:'[ng-show]', bind: { 'ngShow': 'ngShow' }, observe: {'ngShow': 'ngShowChanged'}
}) export class NgShow { constructor(element:Element) { this.element = element; } ngShowChanged(newValue){ if(newValue){ this.element.style.display = 'block'; }else{ this.element.style.display = 'none'; } } } //Components&Databinding @DecoratorDirective
@TemplateDirective({ selector: '[ng-if]', bind: {'ngIf': 'ngIf'}, observe: {'ngIf': 'ngIfChanged'} })
export class NgIf { constructor(viewFactory:BoundViewFactory, viewPort:ViewPort) { this.viewFactory = viewFactory; this.viewPort = viewPort; this.view = null; } ngIfChanged(value) { if (!value && this.view) { this.view.remove(); this.view = null; } if (value) { this.view = this.viewFactory.createView(); this.view.appendTo(this.viewPort); } } } //Components&Databinding @TemplateDirective
The Router
No flexibility. phonecatApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/phones', { templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl' }). when('/phones/:phoneId', { templateUrl: 'partials/phone-detail.html', controller: 'PhoneDetailCtrl' }). otherwise({ redirectTo: '/phones' }); }]); //TheRouter PRESENT KNOWNPROBLEM
? • Configuration/Conventions • 404 Handling • History Manipulation •
Navigation Model • Document Title Updates • hashChange/pushState • Dynamic Loading • Child Apps • Screen Activation ◦TO: canActivate => activate ◦FROM: canDeactivate => deactivate //TheRouter PRESENT IMPLEMENTEDFEATURES
What about structure, scaffolding, build, testing, best practices?
Nothing yet :(
Who is Allan Baptista? Contacts
//Contacts @m4n3z40 @NeverFunnyGuy fb.me/allan.baptista linkedin.com/in/allanbaptista
[email protected]
Who is Allan Baptista? Sources
• http://eisenbergeffect.bluespire.com/all-about-angular-2-0/ • https://docs.google.com/document/d/ 1kpuR512G1b0D8egl9245OHaG0cFh0ST0ekhD_g8sxtI/edit?usp=sharing • https://github.com/angular/angular/issues/133 • https://www.youtube.com/watch?v=h1P_Vh4gSQY •
https://www.youtube.com/watch? v=gNmWybAyBHI&list=UUEGUP3TJJfMsEM_1y8iviSQ • https://www.youtube.com/watch?v=g- x1QKriY90&list=UUEGUP3TJJfMsEM_1y8iviSQ //Sources