這些年,你所不知道的 Angular
2024/12/28 - WebConf TW
1
2
Leo 李歐
• Angular Taiwan 打雜
工
• iT 邦幫忙 2018、2019、2021
•
大
神來六
角
2020~2023
• devfest Taipei 2023
• COSCUP 2022
• 六
角
學院 - TypeScript 30 天證書
培訓營講師(2024)
(陳志龍)
Angular v19 is available!!
2024/11/19
這些年,Angular 變了
• DX 變得更好(less code)
• 程式碼重
用
性更好(同上)
• 更 Reactive (Function Programing)
• 效能更佳(Signal 、 Zoneless)
• Build 速度更外(vite + esbuild)
Standalone Components
Directives/Pipes also (v14+)
Old way
New way
Old way
New way
New way
inject()
(v14+)
Old way
New way
New way
New way
New way
withComponentInputBinding
(v16+)
New way
New way
New way -
New way
Template - Control Flow
(v17+)
Old way - NgIf
New way - NgIf
Old way - NgFor
New way - NgFor
Old way - NgSwtich
New way - NgSwtich
Template - Variables in
templates
(v18.1+)
Old way
New way
❌
Template - @defer
(v17+)
idle Triggers when the browser is idle.
viewport Triggers when speci
f
ied content enters the viewport
interaction Triggers when the user interacts with speci
f
ied element
hover Triggers when the mouse hovers over speci
f
ied area
immediate Triggers immediately after non-deferred content has
f
inished rendering
timer Triggers after a speci
f
ic duration
Angular Signal
(v16+)
Writable signals
Computed signals
Computed signals
effect()
effect() - use case
• 記錄正在顯
示
的資料以及資料何時發
生
變化,
用
於分析或作為 debug
工
具
• 保持資料與 Storage 同步
• 新增無法使
用
範本語法表達的
自
訂 DOM
行
為
• 對 canvas 、 圖表或其他第三
方
UI 函式庫執
行
自
訂渲染
linkedSignal
(v19+)
Old Way
New Way
Sample
Recap
• v14+:StandaloneComponent、inject()
• v16+:Signal、withComponentInputBinding()
• v17+:Control Flow、@defer
• v18.1+: @let
• v19+: LinkedSignal
Reference
• Angular v14 is now available!
• Angular v15 is now available!
• Angular v16 is here!
• Introducing Angular v17
• Angular v18 is now available!
• Meet Angular v19
Reference
• Angular O
ff
icial Doc - Control Flow
• Introducing @let in Angular

[Angular][WenConf 2024] 那些年,你所不知道的 Angular