typeInjection (type, property, fullName) private
Used only via injection
.
Provides a specialized form of injection, specifically enabling all objects of one type to be injected with a reference to another object.
For example, provided each object of type controller
needed a router
. one would do the following:
let registry = new Registry(); let container = registry.container(); registry.register('router:main', Router); registry.register('controller:user', UserController); registry.register('controller:post', PostController); registry.typeInjection('controller', 'router', 'router:main'); let user = container.lookup('controller:user'); let post = container.lookup('controller:post'); user.router instanceof Router; //=> true post.router instanceof Router; //=> true // both controllers share the same router user.router === post.router; //=> true
Parameters:
-
type
String
-
property
String
-
fullName
String
Please login to continue.