I code all my project in Alloy, so no classic Titanium here. I want to load an external custom AlertDialog (located in views/popup.xml) in my index. So my need is to show an alert and destroy it (for ie.) by clicking the OK button. The Help button should do another action.
My popup.xml file :
<Alloy>
<AlertDialog id="popup" title="Error popup"
message="There is an error" cancel="1">
<ButtonNames>
<ButtonName>OK</ButtonName>
<ButtonName>Help</ButtonName>
</ButtonNames>
</AlertDialog>
</Alloy>
My index.js file :
function openPopup(e) {
var page = Alloy.createController('views/popup').getView();
page.show();
};
openPopup();
But this gives me an error :
- [DEBUG] [iphone, 8.1, 192.168.0.1] Native module:alloy/controllers/views/popup
- [ERROR] [iphone, 8.1, 192.168.0.1] Couldn't find module: alloy/controllers/views/popup
- [ERROR] [iphone, 8.1, 192.168.0.1] TypeError: 'undefined' is not a constructor (evaluating 'new (__p.require("alloy/controllers/" + name))(args)')
I have no popup.js and I didn't require any file in index.js too. So my questions are : How to load a controller dynamically? How to remove (or destroy) it with an addEventListener on "click" action? Thank you.
Alloy.createController('popup').getView();
, notviews/popup
– turtle