{ "id": "113474", "key": "AC-2718", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-06-13T18:52:37.000+0000", "created": "2013-04-28T00:39:55.000+0000", "labels": [ "Alloy" ], "versions": [], "issuelinks": [], "assignee": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:41:50.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." } ], "description": "We have a widget that calls Alloy.createController. For some reason it's loading controllers form the main app's controller directory:\r\n\r\n(...)/Our.app/alloy/controllers/foo.js\r\n\r\nrather than the expected location:\r\n\r\n(...)/Our.app/alloy/widgets/this-widget/...\r\n\r\nIn looking at the generated code, it seems that Alloy is defined after the controller:\r\n\r\nfunction Controller() {\r\n...\r\n}\r\nvar Alloy = require(\"alloy\"), Backbone = Alloy.Backbone, _ = Alloy._;\r\n\r\nwhich 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 \r\nthere's more information I can provide.\r\n", "attachment": [], "flagged": false, "summary": "Alloy.createController is using wrong location, Alloy is defined after user controllers in generated code", "creator": { "name": "braco", "key": "braco", "displayName": "Braco", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "braco", "key": "braco", "displayName": "Braco", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "257686", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hi Braco,\nCan you please post a reproducible test case?\nRegards,", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-06-13T18:40:34.000+0000", "updated": "2013-06-13T18:40:34.000+0000" }, { "id": "257699", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "When creating controllers in a widget, use the {{Widget}} object that is present only in widgets instead of Alloy. Using your example above:\n\n{code:javascript}\nvar controller = Widget.createController('foo');\n{code}\n\nFYI, this is probably a better case for a Q&A question in the future.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-13T18:52:19.000+0000", "updated": "2013-06-13T18:52:19.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }