I am new at titanium studio and working alloy mvc framework. I hv two js file in controller folder. one is index.js(created automatically when the project was created) and home.js. Now I want to open home.js on button event from index.js(like starting a new activity from another activity in eclipse android app). Here is my code:
index.js:
function login_Click(e){
Ti.include('home.js');
hello();
}
$.index.open();
where login_click(e) is a button onClick event.
And home.js:
function hello(){
//$.home.open();
alert("Opened");
}
//exports.hello = hello;
but whenever i run it and click the button it gives the error
location:[25,1]alloy/controllers/home.js
massage:uncaught reference error:module is 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;
Plz help me here. I tried require() method. I tried to directly open using $.home.open(); But nothing worked. What do i have to do???? Thanx in advance....