Accessing current array object within Each, to pass to a Class

Sorry, I am guessing this has a very simple answer, but I am just not able to empiric nor google my way out of the problem…

How can I access the current array element, instead of its “properties”, so that I do not need to explicit pass all of the array objects properties to a component class?
I.e (mockup, may contain compile errors, just to show):

	var ArrayOfActions = [
		{label: "Add", description: "Add some action"},
		{label: "Delete", description: "Delete some action"}

<Panel ux:Class="MyButton">	
	<object ux:Property="MyAction"/>		
	       	var localMyAction= this.MyAction.inner();
	<Button Value="{localMyAction.label}" />

<Each Items="{ArrayOfActions}">
	<MyButton MyAction="{OBJECT???}" />

I assume the local javascript in class MyButton is also necessary, according to how I interpret Class-documentation.

Any support would be very much appretiated!

Hi Erland,

your custom component implicitly receives the data context of that iterated item. You don’t need to pass anything. Also, no special local JavaScript viewmodel is necessary (but you can have one if you like).

So then, you can just use {label} and {description} directly, also when inside of your component.

Geesh, I knew I was going to feel stupid about the answer…

Thanks a bunch! Made things so much cleaner.