2017-07-06 7 views
1

私は深く角を理解しようとしていますので、the docsを読むと非常に役に立ちました。
は現在、依存性注入の章では、私はangleは、コンポーネントクラスのコンストラクタに記載されている引数をどのように提供しますか?

angular uses the injector bubbling technique to provide the service mentioned in the constructor

は今インジェクタ泡立ちが親部品一つ一つに行くことを読んで、それを提供するために、サービスの使用可能なインスタンスがあるかどうかを確認します。あなたが(例えば、コンポーネント用)インジェクターを通じてインスタンス化されるクラスの話をしている場合は[はい]、角度がコンストラクタへのすべての引数が注射剤であることを期待

Q1) is the arguments in the constructor are always services?

Q2) if there is other than the services is mentioned in the constructor do they also use the bubbling technique?

+0

_私は深く理解しようとしています - [私の記事](https://medium.com/@maximus.koretskyi)非常に洞察深い –

+1

感謝の気持ちたくさんは、私は –

+1

:)重要な参考として登録 - それはそれはサービスですので、それはまだ、インジェクタに登録する必要があり、誤解を招くようです –

答えて

1

Q1) is the arguments in the constructor are always services?

は、私は2つの質問があります。

Q2) if there is other than the services is mentioned in the constructor do they also use the bubbling technique?

あなたがエラーを取得する任意のインジェクターに定義されていないコンストラクタで何かがある場合:

Cannot resolve all parameters to...

1

is the arguments in the constructor are always services?

いいえ、任意の設定可能な値/変数(配列、オブジェクト、文字列、動的ランタイム文字列など)

if there is other than the services is mentioned in the constructor do they also use the bubbling technique?

はい、依存レゾルバが現在のレベルインジェクタの値を打ちました

+0

_No、任意の設定可能な値/ variable_)私はかなり頻繁に書き、あなたがメディア上で私をフォローしたいかもしれません –

+0

_Yes、依存リゾルバがt_に達するまで - あなたは私の答えに述べたようにエラーが発生します –

関連する問題