I am new to mvc titanium studio and frame design studios. I hv two js files in the controller folder. one is index.js (created automatically when the project is created) and home.js. Now I want to open home.js on a button event from index.js (for example, start a new activity from another activity in the eclipse android application). Here is my code:
index.js:
function login_Click(e){ Ti.include('home.js'); hello(); } $.index.open();
where login_click (e) is the onClick event.
And home.js:
function hello(){
but whenever I run it and press the button, it gives an error
location: [25.1] Alloy / controllers / home.js
massage: incomprehensible reference error: module not defined
source: * module.export = controller;
Here is my alloy / controllers / home.js:
function Controller() { require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments)); arguments[0] ? arguments[0]["__parentSymbol"] : null; arguments[0] ? arguments[0]["$model"] : null; var $ = this; var exports = {}; $.__views.home = Ti.UI.createWindow({ backgroundColor: "white", id: "home" }); $.__views.home && $.addTopLevelView($.__views.home); $.__views.label = Ti.UI.createLabel({ text: "Hell Yeah", id: "label" }); $.__views.home.add($.__views.label); exports.destroy = function() {}; _.extend($, $.__views); $.home.open(); _.extend($, exports); } var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._; module.exports = Controller;
Help me here. I tried the require () method. I tried to open it directly with $ .home.open (); But nothing happened. What do I need to do???? Thanx in advance ....
source share