@@ -5,6 +5,13 @@ import {noop} from "./common";
55
66/**
77 * An interface for getting values from dependency injection.
8+ *
9+ * This injector primarily returns resolve values (using a [[ResolveContext]]) that match the given token.
10+ * If no resolve is found for a token, then it will delegate to the native injector.
11+ * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a naive polyfill.
12+ *
13+ * In Angular 2, the native injector might be the root Injector,
14+ * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.
815 */
916export interface UIInjector {
1017 /**
@@ -25,18 +32,17 @@ export interface UIInjector {
2532 * injector.get(StateService).go('home');
2633 * ```
2734 *
28- * Note:
29- * The code that implements this interface may be Angular 1 `$injector`, Angular 2 `Injector`,
30- * a [[ResolveContext]], or a `ResolveContext` that delegates to the ng1/ng2 injector if keys are missing.
31- *
32- * @param key the key for the value to get. May be a string or arbitrary object.
33- * @return the Dependency Injection value that matches the key
35+ * @param token the key for the value to get. May be a string or arbitrary object.
36+ * @return the Dependency Injection value that matches the token
3437 */
35- get ( key : any ) : any ;
38+ get ( token : any ) : any ;
3639
3740 /**
3841 * Asynchronously gets a value from the injector
3942 *
43+ * If the [[ResolveContext]] has a [[Resolvable]] matching the token, it will be
44+ * asynchronously resolved.
45+ *
4046 * Returns a promise for a value from the injector.
4147 * Returns resolve values and/or values from the native injector (ng1/ng2).
4248 *
@@ -48,8 +54,23 @@ export interface UIInjector {
4854 * });
4955 * ```
5056 *
51- * @param key the key for the value to get. May be a string or arbitrary object.
52- * @return a Promise for the Dependency Injection value that matches the key
57+ * @param token the key for the value to get. May be a string or arbitrary object.
58+ * @return a Promise for the Dependency Injection value that matches the token
59+ */
60+ getAsync ( token : any ) : Promise < any > ;
61+
62+ /**
63+ * Gets a value from the native injector
64+ *
65+ * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].
66+ *
67+ * Example:
68+ * ```js
69+ * let someThing = injector.getNative(SomeToken);
70+ * ```
71+ *
72+ * @param token the key for the value to get. May be a string or arbitrary object.
73+ * @return the Dependency Injection value that matches the token
5374 */
54- getAsync ( key : any ) : any ;
75+ getNative ( token : any ) : any ;
5576}
0 commit comments