[AC-2718] Alloy.createController is using wrong location, Alloy is defined after user controllers in generated code
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-06-13T18:52:37.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy |
Labels | Alloy |
Reporter | Braco |
Assignee | Daniel Sefton |
Created | 2013-04-28T00:39:55.000+0000 |
Updated | 2016-03-08T07:41:50.000+0000 |
Description
We have a widget that calls Alloy.createController. For some reason it's loading controllers form the main app's controller directory:
(...)/Our.app/alloy/controllers/foo.js
rather than the expected location:
(...)/Our.app/alloy/widgets/this-widget/...
In looking at the generated code, it seems that Alloy is defined after the controller:
function Controller() {
...
}
var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._;
which means, I'm assuming, that we're getting the global Alloy instance and not this specific widget. This platform is difficult to debug on, so let me know if
there's more information I can provide.
Hi Braco, Can you please post a reproducible test case? Regards,
When creating controllers in a widget, use the
Widget
object that is present only in widgets instead of Alloy. Using your example above:FYI, this is probably a better case for a Q&A question in the future.