問題タブ [angular-di]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
angular - カスタム ReflectiveInjector 戦略を使用してコンポーネント プロバイダーを取得できますか?
ご存知のように、プロバイダーにはさまざまな戦略useClass
がuseExisting
ありuseFactory
ますuseValue
。しかし、独自の戦略を追加したい場合はどうすればよいでしょうか? 何かのようなもの:
ReflectiveInjector を拡張し、Angular に拡張バリアントを使用させる最良の方法は何ですか? 定義されている場所を見つけましたが、既存の Angular DI メカニズムを上書きする方法をまだ探しています。
PS: なぜそれが必要なのか、既存の戦略を使用しない理由は聞かないでください。私は Angular DI について調査していますが、その答えはそれをよりよく理解するのに役立ちます。