When developing components that interact with a model, in order to pass the model into the component, I’m currently setting up the model on the parent component’s viewModel and passing it in as an attribute on the child component. Here’s a pseudo-code/abbreviated example:
This is working just fine, but I’d like to see a way to import the model directly in the template, since in most cases I don’t really need it in the parent component. Is there an existing way to do this?
Also, help me understand this better. Should the asterisk in *TxnModel make the TxnModel variable available to a “distant cousin” component, like in this example:
There’s one context for variables for the entire template. This means there’s only one *TxnModel allowed for everything.
Because you are exporting a function, you might need the @ symbol to keep stache from running the function and getting its return value. Making your template look like:
It looks like with a generated SuperModel, since it exports both a default export and connection, this is the syntax you have to use. It’s pretty much the same as what you posted. Thank for your help.