Q:

how can I get the attribute of Alloy. Models.room_module in titanium

this is my code :
room_module = Alloy. Models.room_module
console.info "=========room_module======="
console.info room_module
console.info "=========room_module.get room_1======="
console.info room_module.get "room_1"
console.info "=========room_module.room_1======="
console.info room_module.room_1

and this is console output :
[iphone, 8.2, 192.168.1.126] =========room_module=======
[INFO] [iphone, 8.2, 192.168.1.126] {
    "room_1": "客餐厅",
    "room_2": "卧室",
    "room_3": "厨房",
    "room_4": "room",
    "room_5": "room",
    "room_6": "room"
}
[INFO] [iphone, 8.2, 192.168.1.126] =========room_module.get room_1=======
[INFO] [iphone, 8.2, 192.168.1.126] 客餐厅
[INFO] [iphone, 8.2, 192.168.1.126] =========room_module.room_1=======
[INFO] [iphone, 8.2, 192.168.1.126]

why room_module.room_1 can't get the value ?  and I wanna show room_module.room_1 to my xml file.  How can I do that ? 

A:

As you may know, Alloy Models inherit from Backbone's.  When you make a call to Model.get function, this is what's happening:
// Get the value of an attribute. 
    get: function(attr) {
      return this.attributes[attr];
    },

When you call console.info(Model), it might be executing Model.toJSON (It doesn't have a toString method):
// Return a copy of the model's `attributes` object. 
    toJSON: function(options) {
      return _.clone(this.attributes);
    },

I see two possibilities:

room_module.attributes['room_1']
room_module.toJSON().room_1

In Alloy docs states nothing about accessing your model inside the xml file.  You will need to access it from the controller.