How to inject a raw property #40
-
I'd like to inject a raw property into my component (a string, number, or raw JSON variable). For example, I have this component: interface SomeJsonInterface {
a: string;
b: {
c: string;
d: number;
}
e: number[];
}
interface SomeComponentArgs {
someString: string;
someNumber: number;
someJson: SomeJsonInterface;
}
export class SomeComponent {
constructor(args: SomeComponentArgs) {
// ...
}
} How would I wire up this component in the configuration? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I assume you're using the generator in the solid server. In that case, instantiating it via a config file happens in the standard way. {
"@id": "urn:something",
"@type": "SomeComponent",
"SomeComponent:_someString": "abc",
"SomeComponent:_someNumber": 123,
"SomeComponent:_someJson_a": "def",
...
} |
Beta Was this translation helpful? Give feedback.
-
Is there no way to provide so nice raw JSON? Do I have to do it via underscores? |
Beta Was this translation helpful? Give feedback.
-
No, there's no way to do this at the moment. But should be perfectly possible to implement this though. |
Beta Was this translation helpful? Give feedback.
I assume you're using the generator in the solid server.
If so, it will generate parameters for all fields (
SomeComponent:_someString
,SomeComponent:_someNumber
,SomeComponent:_someJson_a
, ...)You can find the exact param identifiers inside the autogenerated
components
folder.In that case, instantiating it via a config file happens in the standard way.
So here this would look something like: