文前言:看著 Angular 低版本使用高版本差異觀察…
Angular 11 book
版本:
Angular ^17.0.0
rxjs ~7.8.0
rxjs-chat/.../messages.service.ts
:
ref1
ref2: .pipe() + map + .subscribe()
.scan(...)
, .publishReplay(1)
, .refCount()
, .filter(...)
, .map(...)
皆改為在 .pipe()
中呼叫的 operators
匯入 moment
:(要先 npm i moment
原本 import * as moment from 'moment';
改為 import moment from 'moment';
Tour of Hero
看著 Angular 16 官方中文版一邊使用 v18 版
建立元件
只記得當時要建立時因為 npm
還是 node.js
版本太低所以不給建…要處理就是升級。
6. 從伺服器獲取資料
Q: HttpClientModule is deprecated.
A: v18 中棄用,替代方案為
provideHttpClient()
ref: HttpClientModule is deprecated in Angular 18, what’s the replacement? - Stack Overflow
模擬資料伺服器
Q: 做完此部分後依舊不能跑
A: 參考 Angular 17 in-memory-web-api cannot find the route to the in-memory data? - Stack Overflow
加上
=>
雖然能跑,但還是會有錯誤:
ERROR RuntimeError: NG04002: Cannot match any routes. URL Segment: ‘api/heroes’
Written with StackEdit.
Comments
Post a Comment