[ALOY-808] Alloy: Can't use 'Alloy.CFG' in a model definition
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-11-26T22:41:42.000+0000 |
| Affected Version/s | Alloy 1.2.0 |
| Fix Version/s | Alloy 1.4.0 |
| Components | n/a |
| Labels | alloy, globals, model, qe-manualtest, scope |
| Reporter | Daniel Sefton |
| Assignee | Tony Lukasavage |
| Created | 2013-08-02T08:15:08.000+0000 |
| Updated | 2014-11-26T22:41:42.000+0000 |
Description
I want to use
Alloy.CFG in my model definition:
exports.definition = {
config: {
columns: { .. }
URL: Alloy.CFG.API + '/json/gettasks',
adapter: {
type: "restapi",
collection_name: "todo",
idAttribute: "id"
}
}
};
But I get:
[ERROR] [iphone, 6.1.3, 192.168.0.101]
Type: TypeError
Message: 'undefined' is not an object (evaluating 'Alloy.CFG')
File: /alloy/models/Todo.js
Line: 4
If I change it to require('alloy').CFG all is OK, but that's just ugly ;)
Actually I wonder why this doesn't work, since Alloy should be available as a global, but I guess it's solved easily by just moving the line following the exports.definition object, where var Alloy is defined, to the top of the generated file?
Attachments
| File | Date | Size |
|---|---|---|
| app.zip | 2014-02-06T16:17:45.000+0000 | 5903996 |
PR: https://github.com/appcelerator/alloy/pull/330
Functional test: 1. Create a new Alloy project 2. Overwrite the app folder in your project with the contents of the attached file. 3. Build using the PR-version of Alloy 4. You should get a simple tableview with a few names listed, no error messages.
Tested as directed by [~skypanther], a tableview with a few names is displayed with no error messages. Verified the fix using the following environment: Device : iPhone 5s , iOS version : 7.1 SDK: 3.3.0.v20140508135704 CLI version : 3.3.0-dev OS : MAC OSX 10.9.2 Alloy: 1.4.0-dev ACS: 1.0.14 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201405080918 titanium-code-processor: 1.1.1 XCode : 5.1.1