feat(Platform): allow DI override of userAgent

オープン
#33,751 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
angular, typescript
領域
frontend

調査の方向性

navigator.userAgent へのグローバルなアクセスが定義されている src/cdk/platform/platform.ts から始め、周辺の platform injection の設定を調べます。要求された injectable な user-agent ソースを既存の DOCUMENT へのアクセスと比較し、ブラウザーの動作を維持したまま SSR で結果を検証します。呼び出し元が DI を通じて user agent を上書きできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area: cdk/platform feature gemini-triaged needs triage
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, or maybe at least inject(DOCUMENT).defaultView?.navigator?.userAgent way of accessing it, rather than just global navigator.userAgent

Use Case

No response

主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 2時間
マージ済み PR(30日)
81

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/components のほかの issue

angular/components の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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