13 Sessions + Panel
350 Attendees
v8.2.9 (stable)
v9.0.0 (next)
@DanWahlin
@John_Papa
It's 2019 ... Can't web HTML/CSS/JS just do everything for us?
- Matias
@mauriziovitale_
Over 1500+ Applications!
lessons learned?
<div [ngClass]="myClassExp"
[ngStyle]="myStyleExp">
...
</div>
@Directive({
selector: '[ngStyle]'
})
class NgStyleDirective {
@Input('ngStyle')
ngStyleVal: string;
@Input('style')
styleVal: string;
}
@FabianGosebrink
# update the CLI tool
ng update @angular/cli
# update the core
ng update @angular/core
# start your app
ng serve
<!-- older browsers get this -->
<script type="my-app-es5.js"
nomodule>
</script>
<!-- newer browsers get this -->
<script type="my-app-es2015.js"
type="module">
</script>
// tsconfig.json
{
"compilerOptions": {
// ...
"target": "es2015",
// ...
}
}
@bonnster75
@thelittlestdev
@MikeRyanDev
@jdjuan
class UserClass {
state = "...";
method1() {...}
method2() {...}
method3() {...}
}
// or?
user = ["..."];
function fn1(array) {...}
function fn2(array) {...}
function fn3(array) {...}
function fn4(array) {...}
function fn5(array) {...}
JS Bundle Size Optimizations...
class User {
private _first: string;
private _last: string;
private _age: number;
getFullName() {
return this._first + ' ' + this._last;
}
isOlderThan(age) {
return this._age > age;
}
}
var User = function() {
function t() {}
t.prototype.getFullName = function() {
return this._first + " " + this._last
};
t.prototype.isOlderThan = function(t) {
return this._age > t
};
return t;
}();
const enum UserIndex {
FirstNamePosition = 0,
LastNamePosition = 1,
AgePosition = 2
}
interface User extends Array<number|string> {
[UserIndex.FirstNamePosition]: string;
[UserIndex.LastNamePosition]: string;
[UserIndex.AgePosition]: number;
}
function getFullName(user: User) {
return user[UserIndex.FirstNamePosition] +
user[UserIndex.LastNamePosition];
}
function isOlderThan(user: User, age: number) {
return user[UserIndex.AgePosition] > age;
}
function g(u) {
return u[0] + u[1]
}
function i(u, n) {
return u[2] > n
}
Average reduction of 30% in bundle size...
// this code is used!
element(0, 'div');
select(0);
attribute('title', 'my elm');
styleProp('color', 'red');
classProp('ready', true);
listener(0, 'click', () => {...});
// unused code
function styleMap() {...}
function classMap() {...}
function query() {...}
<video controls poster="poster.png">
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
</video>
@Component({
selector: 'video'
})
class VideoComponent {
@Input('poster')
posterUrl: string;
@Input('controls')
hasControls: any;
@ContentChildren(VideoSourceComponent)
sources: QueryList<VideoSourceComponent>;
}
function AppTemplate(ctx, rf) {
if (rf & CREATE) {
elementStart(0, 'video');
attribute('controls', true);
attribute('poster', 'poster.jpg');
element(1, 'source',
['src', 'movie.mp4', 'type', 'video/mp4']);
element(2, 'source',
['src', 'movie.ogg', 'type', 'video/ogg']);
elementEnd();
}
}
element() | styleMap() | container() |
attribute() | listener() | pipe() |
styleProp() | property() | projection() |
classProp() | select() | i18n() |
classMap() | text() | sanitize() |
All unused instructions are thrown away...
Smaller, portable web components
<body>
<!-- custom element -->
<calendar-widget></calendar-widget>
<!-- custom element -->
<chat-widget></chat-widget>
</body>
@FabianGosebrink
<div
[style.width]="myWidth"
[style]="myStyles"
[class.active]="myActiveClass"
[class]="myClasses">
...
</div>
<!-- CSS classes -->
<!-- style values too -->
<header
[class]="headerClasses"
[class.ready]="isReady"
[style]="headerStyles"
my-style-directive>
...
</header>
@Directive({
selector: '[my-styled-dir]'
})
class MyStyledDir {
@HostBinding('style')
styles = {
border: '10px solid red'
}
}
ng.getComponent();
ng.getDebugNode();
ng.getHostElement();
ng.markDirty();
# when creating a new app
ng new my-app --enable-ivy
# or update tsconfig.json
"angularCompilerOptions": {
"enableIvy": true
}
98%
Passing within Google
v9.0
Angular Migration /
Change Detection
Performance / Monitoring
Mixed reality / 3D data in a 2D world
PWAs => Native Mobile Apps
Developing a mixed 3d reality
Enjoy the rest of the conference! :)
- Matias