feat(Platform): allow DI override of userAgent
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### Feature Description
Right now it is hardcoded as global `navigator.userAgent`:
https://github.com/angular/components/blob/main/src/cdk/platform/platform.ts
However in SSR there's a way to get userAgent from the request and accessing global entities is bad practice. Would be great if there was a token for userAgent [like we do here](https://github.com/taiga-family/ng-web-apis/blob/main/libs/common/src/tokens/user-agent.ts), or maybe at least `inject(DOCUMENT).defaultView?.navigator?.userAgent` way of accessing it, rather than just global `navigator.userAgent`
### Use Case
_No response_
コントリビューションガイド
調査の方向性
Start in src/cdk/platform/platform.ts, where the global navigator.userAgent access is defined, and inspect the surrounding platform injection setup. Compare the requested injectable user-agent source with the existing DOCUMENT access and verify the result in SSR while preserving browser behavior; done means callers can override the user agent through DI.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100