1 of 27

the future of AngularJS

brian ford → @briantford

2 of 27

the past → the present

"reimagine the browser"

0.9.0 oct 2010

0.10.0 sep 2011

1.0.0 jun 2012

1.1.0 aug 2012

1.2.0-rc.1 aug 2013

changing browsers → time for more imagination

3 of 27

the future

angular + standards =

  • es6 modules
  • web components

4 of 27

the future

standards are mostly:

→ still in flux

→ not implemented in browsers

we (the angular team) are mostly:

→ still in the exploratory phase

→ excited about these things :)

consider this an early preview

5 of 27

js modules of today

→ <script> + globals

→ require.js

→ AMD

→ CommonJS (node, browserify)

→ UMD (catch-all for the above)

6 of 27

es6 modules

→ new dependency injection

based on es6 modules

→ easier to share and use modules

across frameworks

→ easier to use/write tools around them

(think bower, yeoman, etc)

7 of 27

es6 modules

now:

angular.module('myStuff' []).

value('x', 42);

future:

module "myStuff" {

export let x = 42;

}

8 of 27

es6 modules

$location

$compile

$http

$injector

$parse

dateFilter

ngRepeat

etc...

angular.js

angular-resource.js

angular-route.js

angular-sanitize.js

+ angular-http.js

+ angular-filter.js

+ ...

9 of 27

es6 modules + http2 (aka spdy)

Server

HTTP/1.1

Browser

index.html

app.js

my-module.js

my-partial.html

Server

HTTP/2.0

Browser

index.html

Now

Future

index.html

app.js

my-module.js

my-partial.html

4 requests → 4 responses

1 requests → 4 responses

10 of 27

es6 modules

less js

interoperability

better tools

11 of 27

web components

web components =

  • templates
  • decorators
  • custom elements
  • shadow dom
  • imports

12 of 27

templates

what is it:

container for dom-to-be

13 of 27

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>

14 of 27

templates

not parsed

won't load images

no security issues

no html-in-a-string grossness

15 of 27

decorators &

custom elements

what is it:

standard for what angular is kinda

already doing with directives

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

...

</element>

<fancy-button></fancy-button>

16 of 27

shadow dom

what is it:

lets you encapsulate html

inside a single special container

that looks like one element on the outside

think transclusion in angular 1.x

17 of 27

shadow dom

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>

18 of 27

shadow dom

a directive's new best friend

better encapsulation

less cognitive overload

19 of 27

when to render?

now:

digest cycle, dirty-checking, $apply

future:

(this space left intentionally blank)

20 of 27

Object.observe

native javascript support for getting notifications that an object changed

21 of 27

$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

22 of 27

$apply? more like $goodbye

with Object.observe, there's no need to manually tell angular that your app's model updated

23 of 27

object.Observe

but how?

var x = {};

Object.observe(x, console.log);

x.prop = 'some value';

// [ { type: 'new',

// object: {

// prop: 'some value'

// },

// name: 'prop' } ]

24 of 27

object.Observe

simplified api

performance gains

25 of 27

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

26 of 27

resources

caniuse.com

html5rocks.com

w3.org

27 of 27

brian ford → @briantford

fin