当推入数组时,AngularFire在引用Object时替换$ id

时间:2014-08-07 18:39:30

标签: angularfire

不确定我在这里做错了什么:

var eventDetails = new Event(key);

.factory("Event", ["$FirebaseObject", "$firebase",
function($FirebaseObject, $firebase, settings) {

    var EventFactory = $FirebaseObject.$extendFactory({
    });

    return function(eventId) {

        var ref = FIREBASE_REF.child('events/' + eventId);

        var sync = $firebase(ref, {
            objectFactory: EventFactory
        });

        return sync.$asObject(); // this will be an instance of UserFactory
    }
}
])

eventDetails.$loaded(function(){
    eventList.push(eventDetails);
});

eventList中的每个项都是$ id =同一个对象的对象,而不是$ id = some string。

0 个答案:

没有答案