+ All Categories
Home > Documents > The Future of AngularJS

The Future of AngularJS

Date post: 13-Apr-2016
Category:
Upload: tranthiecchan
View: 7 times
Download: 0 times
Share this document with a friend
Description:
The Future of AngularJS.pdf
27
the future of AngularJS brian ford → @briantford
Transcript
Page 1: The Future of AngularJS

the future of AngularJSbrian ford → @briantford

Page 2: The Future of AngularJS

the past → the present

"reimagine the browser"

0.9.0 oct 20100.10.0 sep 20111.0.0 jun 20121.1.0 aug 20121.2.0-rc.1 aug 2013

changing browsers → time for more imagination

Page 3: The Future of AngularJS

the future

angular + standards = ♥● es6 modules

● web components

Page 4: The Future of AngularJS

the future

standards are mostly: → still in flux → not implemented in browserswe (the angular team) are mostly: → still in the exploratory phase → excited about these things :)

consider this an early preview

Page 5: The Future of AngularJS

js modules of today

→ <script> + globals→ require.js→ AMD→ CommonJS (node, browserify)→ UMD (catch-all for the above)

Page 6: The Future of AngularJS

es6 modules

→ new dependency injectionbased on es6 modules→ easier to share and use modulesacross frameworks→ easier to use/write tools around them (think bower, yeoman, etc)

Page 7: The Future of AngularJS

now:angular.module('myStuff' []).

value('x', 42);

future:module "myStuff" {

export let x = 42;

}

es6 modules

Page 8: The Future of AngularJS

es6 modules

$location

$compile

$http

$injector

$parse

dateFilter ngRepeat

etc...

angular.js

angular-resource.jsangular-route.jsangular-sanitize.js+ angular-http.js+ angular-filter.js+ ...

Page 9: The Future of AngularJS

es6 modules + http2 (aka spdy)

ServerHTTP/1.1

Browser

inde

x.ht

ml

app.

js

my-

mod

ule.

js

my-

parti

al.h

tml

ServerHTTP/2.0

Browser

inde

x.ht

ml

Now Future

index.html

app.jsm

y-module.js

my-partial.htm

l

4 requests → 4 responses 1 requests → 4 responses

Page 10: The Future of AngularJS

es6 modules

✓ less js

✓ interoperability

✓ better tools

Page 11: The Future of AngularJS

web components

web components =

● templates● decorators● custom elements● shadow dom● imports

Page 12: The Future of AngularJS

templates

what is it:

container for dom-to-be

Page 13: The Future of AngularJS

templates

now:<script type="text/ng-template"

id="/my-template.html">

<span>{{hello}}</span>

<img src="{{picture}}">

</script>

future:<template id="my-template">

<span>{{hello}}</span>

<img src="{{picture}}">

</template>

Page 14: The Future of AngularJS

templates

✓ not parsed

✓ won't load images

✓ no security issues

✓ no html-in-a-string grossness

Page 15: The Future of AngularJS

decorators &custom elements

what is it:

standard for what angular is kindaalready doing with directives

<element extends="button" name="fancy-button">

...

</element>

<fancy-button></fancy-button>

Page 16: The Future of AngularJS

shadow dom

what is it:

lets you encapsulate htmlinside a single special containerthat looks like one element on the outside

think transclusion in angular 1.x

Page 17: The Future of AngularJS

if you look at the dom…

now:<div class="pane-container">

<div class="pane-row pane-active">

<div class="pane">{{hello}}</div>

</div>

</div>

future:<!-- the other divs are hidden from the outside world -->

<div class="shadow-pane">{{hello}}</div>

shadow dom

Page 18: The Future of AngularJS

shadow dom

a directive's new best friend

✓ better encapsulation

✓ less cognitive overload

Page 19: The Future of AngularJS

when to render?

now:

digest cycle, dirty-

checking, $apply

future:

(this space left intentionally blank)

Page 20: The Future of AngularJS

Object.observe

native javascript support

for getting notifications that

an object changed

Page 21: The Future of AngularJS

$apply? more like $goodbye*

now:socket.on('data', function (data) { $scope.$apply(function () {

$scope.model = data;

});

});

future:socket.on('data', function (data) { $scope.$apply(function () {

$scope.model = data;

});

});*$goodbye is not an upcoming angular api

Page 22: The Future of AngularJS

$apply? more like $goodbye

with Object.observe,

there's no need to

manually tell angular that

your app's model updated

Page 23: The Future of AngularJS

object.Observe

but how?var x = {};

Object.observe(x, console.log);

x.prop = 'some value';

// [ { type: 'new',

// object: {

// prop: 'some value'

// },

// name: 'prop' } ]

Page 24: The Future of AngularJS

object.Observe

✓ simplified api

✓ performance gains

Page 25: The Future of AngularJS

summary

→ this is an early preview

of what we hope the future

looks like someday maybe

→ angular will definitely

co-evolve with standards

as they mature for certain

Page 26: The Future of AngularJS

resources

caniuse.com

html5rocks.com

w3.org

Page 27: The Future of AngularJS

fin

brian ford → @briantford


Recommended