angular / angular/components

feat(Platform): allow DI override of userAgent

オープン
#33,751 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/platform feature gemini-triaged needs triage
主要言語
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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。