Reputation: 67
I am trying to implement a list view in Appcelerator. On the click event of a list item, a new controller should appear and according to the item index and the URL mentioned in the list item, the video should auto play in the new controller. Every list item has a different URL that should play on the click event of that list item. I have implemented the list view and am unable to figure out how to pass the argument e of the call back function to another controller, for it to recognize it and play the appropriate video.
Upvotes: 0
Views: 265
Reputation: 118
I do not yet understand your whole usecase, but usually you pass arguments to a new Controller via a dictionary in the Constructor:
index.js
var myCtrl = Alloy.createController("MyController", {
//put your arguments here
});
You can recieve the args in the created controller by using $.args
if you create the Controller via require in the XML you have to call a setter.
index.xml
<Alloy>
<require src="MyController" id="myCtrl"/>
</Alloy>
index.js
$.myCtrl.setArgs({
//put your arguments here
})
MyController.js
$.setArgs = function(args){
//handleNewArgs
}
Upvotes: 0