How do I get the unique id of ember object when object is initialized?
问题 I have instantiated the model using createRecord. Now how do I get the id of that record before it is saved ? 回答1: You can consider the generateIdForRecord http://emberjs.com/api/data/classes/DS.Adapter.html#method_generateIdForRecord If the globally unique IDs for your records should be generated on the client, implement the generateIdForRecord() method. This method will be invoked each time you create a new record, and the value returned from it will be assigned to the record's primaryKey.