Titanium JIRA Archive
Alloy (ALOY)

[ALOY-808] Alloy: Can't use 'Alloy.CFG' in a model definition

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-11-26T22:41:42.000+0000
Affected Version/sAlloy 1.2.0
Fix Version/sAlloy 1.4.0
Componentsn/a
Labelsalloy, globals, model, qe-manualtest, scope
ReporterDaniel Sefton
AssigneeTony Lukasavage
Created2013-08-02T08:15:08.000+0000
Updated2014-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

FileDateSize
app.zip2014-02-06T16:17:45.000+00005903996

Comments

  1. Tony Lukasavage 2014-02-05

    PR: https://github.com/appcelerator/alloy/pull/330
  2. Tim Poulsen 2014-02-06

    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.
  3. Paras Mishra 2014-05-12

    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

JSON Source