Using Alloy model and collection without a view data binding #13556
Answered
by
m1ga
beppo-ivel
asked this question in
Q&A
-
I create some models of type random in views/index.xml
lib/util.js
models/random.js
controllers/index.js
|
Beta Was this translation helpful? Give feedback.
Answered by
m1ga
Sep 2, 2022
Replies: 1 comment 3 replies
-
I like that you put an example in there but I've removed some parts to make it easier to debug/solve 😄 Feel free to add your location stuff back in (since that has nothing todo with the model I left it out) Model and lib is the same. <Alloy>
<Collection src="random"/>
<Window class="container" onClick="doClick" />
</Alloy> let Util = require('/util');
function doClick(e) {
Util.record(e);
let models = Alloy.Collections.random;
models.fetch();
console.log(JSON.stringify(models));
}
$.index.open(); click anywhere and it will output the model. I've registered the Collection in the XML file and do a |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
beppo-ivel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like that you put an example in there but I've removed some parts to make it easier to debug/solve 😄 Feel free to add your location stuff back in (since that has nothing todo with the model I left it out)
Model and lib is the same.
click anywhere and it will output the model. I've registered the Collection in the XML file and do a
fetch()
.