What is the equivalent in javascript to Clear the Childrens?
In UNO I clean the children like this:
UX:
<StackPanel ux:Name="MyStackPanel">
<Element />
<Element />
<Element />
<Element />
</StackPanel>
UNO:
MyStackPanel.Children.Clear();
How can I do this in javascript?
JavaScript cannot directly manipulate the UI, but you can do it with observables:
var elements = Observable(1,2,3,4);
Make sure you include elements
in your module.exports
, then:
<StackPanel>
<Each Items="{elements}">
<Element />
</Each>
</StackPanel>
Now you can add and remove from elements
in JS.
elements.add("foo");
elements.removeAt(1);
Perfect but how can I remove all elements of “elements” if I dont know how many elements are?
I get elements from Parse and when I refresh I like to clean all the elements and replace it with the new query.
Thanks!
Thanks! This documentation was looking for :)!