Your solution seems right. I will try it. Meanwhile, here’s what I should have included in my question.
( I was finger typing on my phone)
This is the original, non-dynamic spec:
define({
settingsA:{
module: 'modules/settings/settingsA'
},
settingsB:{
module: 'modules/settings/settingsB'
},
strings:{
module: 'modules/resources/strings'
},
controllers:{
create: 'modules/app/controllerRegistry',
properties: {
main: {
create: {
module: 'modules/controllers/base',
args:{
module: 'modules/controllers/main',
}
},
properties:{
settings:{
$ref: 'settingsA'
}
}
},
about: {
create: {
module: 'modules/controllers/base',
args:{
module: 'modules/controllers/about',
}
},
properties:{
settings:{
$ref: 'settingsB'
},
strings:{
$ref: 'strings'
}
}
}
}
}
});
The task I have is to externalize the “controller spec” and make it so we can create new controllers with default properties and only have to add more details if necessary.
So the problem I see here is “properties” must be named in the spec! It does not seem like I can pass in a dynamically changing collection of JSON properties.
controllerSpec.js
define({
subclass : {},
controllerFactory : {
create : {
module : 'modules/controllers/base',
args : {
$ref : 'subclass'
}
},
properties : {
settings : {
$ref : 'settingsA'
}
}
}
});
I can successfully feed in “subclass” here from the “provide” facet in my new main.js. But I cannot feed in the dynamic “properties”…. Any attempt to use a $ref in properties seems to leave me with an unresolved expression. How can I do that?
Thanks,
Ben