Rob Wormald
Angular Everywhere
@robwormald
Rob Wormald
Developer Advocate @ Google
@robwormald
github.com/robwormald
Angular Everywhere
Unified Development
So I should build a mobile web app, right?
Most of the mobile web today is terrible.
https://www.doubleclickbygoogle.com/articles/mobile-speed-matters/
https://www.doubleclickbygoogle.com/articles/mobile-speed-matters/
https://www.doubleclickbygoogle.com/articles/mobile-speed-matters/
So I should build a native mobile app, right?
Now you have three problems...
Android App
Mobile Web
¥ 433 / $3.75
¥ 8 / $0.07
Housing.com: User Acquisition Costs
So I should build a web app, right?
Native APIs?
USB?
things-chrome-apps-did-but-can’t-anymore? (Serial)
Windows Universal APIs?
So I should build a web app, right?
native
desktop
mobile web
You should just build an app
(we’ll handle the rest)
Angular Everywhere
Server
Browser
Web 1.0
Web Server
Initial Request
HTML Document
Form POST
HTML Document
Server
Browser
Web 2.0 - Single Page Apps
Web Server
Initial Request
Document
AJAX
JSON
AJAX
JSON
NG1 architecture
Application
DOM
Angular
Angular Renderer architecture
Application
DOM
Server
App Shell
...
Renderer
Where to do the work?
100% Client Side
100% Server Side
Where to do the work?
100% Client Side
100% Server Side
Angular 1
PHP
Angular
100% Client Side
100% Server Side
Angular 2
Progressive Web Apps
A Progressive Web App uses modern web capabilities to deliver an app-like user experience. They evolve from pages in browser tabs to immersive, top-level apps, leveraging the web's low friction.
https://developers.google.com/web/progressive-web-apps
app-like user experience.
@robwormald
@robwormald
First experience
Single Page Apps today
<link rel="stylesheet" href="core.css">
<link rel="stylesheet" href="maps.css">
<link rel="stylesheet" href="forms.css">
�<script src="app/init.js">
<script src="app/home.js">
<script src="app/settings.js">�<script src="app/admin.js">
<script src="app/charts.js">
<script src="app/maps.js">�<script src="app/about.js">�<script src="app/inbox.js">�<script src="app/forms.js">
<script src="app/modules.js">
Empty Window
<html>
<head>
<style> … </style>
</head>
<body>
<app></app>
</body>
</html>
@robwormald
Empty Window
<html>
<head>
<style> … </style>
</head>
<body>
<app></app>
</body>
</html>
Application Shell
App Shell
100% Client Side
100% Server Side
App Shell
Application shell
<html>
<head>
<style> … </style>
</head>
<body>
<issue-cli-app>
<md-sidenav-layout>
…
</md-sidenav-layout>
</issue-cli-app>
<script async></script>
</body>
</html>
Dynamic content loaded
<html>
<head>
<style> … </style>
</head>
<body>
<issue-cli-app>
<md-sidenav-layout>
…
</md-sidenav-layout>
</issue-cli-app>
<script async></script>
</body>
</html>
Declarative application shell
<md-sidenav-layout>
<div *shellRender>
Loading...
</div>
<router-outlet *shellNoRender></router-outlet>
</md-sidenav-layout>
App Shell - gulp
import {AppComponent} from "./app”
import * as gulp from "gulp”
import {gulpPrerender} from "@angular/universal”
gulp.task("prerender”, () => {
return gulp.src(["index.html”])
.pipe(gulpPrerender({
directives: [ AppComponent ]
}));
});
Angular Universal
Universal
100% Client Side
100% Server Side
Universal
Angular Universal - express
import {AppComponent} from "./app”
import {expressEngine} from "@angular/universal”
import * as express from "express”
let server = express();
server.engine(".html”, expressEngine);
server.get("/”, (req, res) => {
res.render("index”, { directives: [ AppComponent ] });
});
server.listen(8080);
Server rendering benefits
Performance
SEO
Shareability
Server Rendering: Universal
Node.js
ASP.NET
Others...
Angular Universal
Today:
Experimental
Community Driven
Soon:
Angular Core (@angular/platform-universal)
Core maintained
Community supported
WARNING! Experimental!
@robwormald
AMP Pages
AMP Pages
100% Client Side
100% Server Side
AMP
AMP Pages
NO JS?! wat?
AMP Pages (No JS!)
NO JS?! wat?
wat
PWAMP (AMP + PWA)
Service worker enhancement
Serve AMP Page
User Navigates
Install Service Worker
PWA!
Download PWA
SW Intercept Request
Progressive Web Apps
PWA
What else do users care about?
@robwormald
PWA - Install Banner
@robwormald
@robwormald
PWA - Already Everywhere
chrome://serviceworker-internals/
@robwormald
PWA - Already Everywhere
@robwormald
Time check?
@robwormald
Cordova
@robwormald
Cordova
Web applications + Native Mobile APIs
@robwormald
Cordova - Javascript APIs
Camera
Filesystem
DB
Many more
@robwormald
Cordova - Mix and Match
Native Application
Authentication & Login
Settings
Cordova & Webviews
@robwormald
Cordova - Getting Started
npm i -g cordova
cordova create app-name
@robwormald
Cordova
Angular applications are inherently architected in a way that matches mobile.
@robwormald
Ionic Framework
@robwormald
Ionic
@robwormald
Ionic Components
<ion-list radio-group>� <ion-list-header>� Language� </ion-list-header>�� <ion-item>� <ion-label>Go</ion-label>� <ion-radio value="go"></ion-radio>� </ion-item>
...
@robwormald
Ionic
Ionic was designed for mobile experience, built from the ground up using Angular
@robwormald
NativeScript
@robwormald
NativeScript
Angular Platform, Native Rendering
@robwormald
NativeScript - Getting Started
npm install -g nativescript
tns create my-app-name --ng
@robwormald
NativeScript - Example Template
@Component({� selector: "my-app",� template: `� <TextField hint="Email Address" keyboardType="email"� autocorrect="false" autocapitalizationType="none"></TextField>� <TextField hint="Password" secure="true"></TextField>�� <Button text="Sign in"></Button>� <Button text="Sign up for Groceries"></Button>� `�})�export class AppComponent {}
@robwormald
NativeScript
Angular makes NativeScript awesome by letting you build Angular apps that render to Native UI Elements.
@robwormald
Electron
@robwormald
Electron
Web applications + Native Desktop APIs
@robwormald
Electron
@robwormald
Windows Apps
@robwormald
UWP Apps
Web applications + Native Desktop APIs
@robwormald
Electron
@robwormald
/code
Angular Release Cycle
Angular release cycle
Semantic Versioning (semver)
http://semver.org/lang/ja/
Semantic versioning - Patch Release
2.0.X
Semantic versioning - Minor Release
2.X.0
Semantic versioning - Major Release
X.0.0
BREAKING CHANGES
Semantic versioning - Deprecation Policy
Semantic versioning - Deprecation Policy example
2.3.0 - API introduced
magicBox.doSomethingAmazing()
4.1.0 - API deprecated
4.2.0 - OK!
4.3.x - OK!
5.x.x - Warning (but OK!)
6.x.x - Removal
Problem - this is confusing
Angular 3.0.0 + Router 4.0.0?
Problem - this is confusing
Angular 3.0.0 + Router 4.0.0
Angular 4.0.0 + Router 5.0.0
Angular 5.0.0 + Router 6.0.0
Angular 6.0.0 + Router 7.0.0
Problem - this is confusing
Angular 3.0.0 + Router 4.0.0
Breaking News!
Angular 3.0.0 + Router 4.0.0
Breaking News!
Angular 4.0.0 - 2017年3月
Major Release schedule
2016年9月
2017年3月
2017年8月
2.x.x | 4.x.x |
Major Release schedule
2016年9月
2017年3月
2.x.x |
2.0.x | 2.1.x | 2.2.x |
2.3.x |
Stable Phase - 安定
Creative Phase 創造性
Major Release schedule
2017年3月
2017年9月
4.x.x |
4.0.x | 4.1.x | 4.2.x |
4.3.x |
Stable Phase - 安定
Creative Phase 創造性
Major Release schedule - prerelease
2017年3月
2017年9月
4.x.x |
4.0.x | 4.1.x | 4.2.x |
4.3.x |
Stable Phase - 安定
Creative Phase 創造性
5.0 β.1 | 5.0 β.2 | 5.0 β.3 |
4.1 β | 4.2 β | 4.3 β |