Closed ouadi closed 10 years ago
Hey @ouadi,
There is a way! Use the wire facet, properties
, to inject properties. You use it like this:
{
myComponent: {
create: 'app/myModule',
properties: {
answer: 42,
question: { $ref: 'anotherComponent' }
}
}
}
The properties
facet will inject the properties during the configure phase. That is, shortly after construction.
More info here: https://github.com/cujojs/wire/blob/master/docs/configure.md#properties
If I misunderstood your question, please reopen this issue. :)
Regards,
-- John
Hay John,
Thank you very much for your help. The proposed spec fulfill my need perfectly.
Warm regards.
Younes
On Mon, Nov 11, 2013 at 3:27 PM, John Hann notifications@github.com wrote:
Hey @ouadi https://github.com/ouadi,
There is a way! Use the wire facet, properties, to inject properties. You use it like this:
{ myComponent: { create: 'app/myModule', properties: { answer: 42, question: { $ref: 'anotherComponent' } } }}
The properties facet will inject the properties during the _configure_phase. That is, shortly after construction.
More info here: https://github.com/cujojs/wire/blob/master/docs/configure.md#properties
If I misunderstood your question, please reopen this issue. :)
Regards,
-- John
— Reply to this email directly or view it on GitHubhttps://github.com/cujojs/wire/issues/143#issuecomment-28208645 .
Glad to help. :)
Dears,
IoC like StringFramework allows injecting dependencies in two forms: as constructor arguments and as properties.
CujoJS/WireJS version 0.10.2 supports only the first form. Is there a chance to implement the second form?
Cheers.