Tracker.autorun()
의 개체 속성에 액세스 할 수 없습니다. 나는 console.log()
수 있지만 object.id
또는 object[id]
또는 object["id"]
할 수 없습니다. 내가 부족 뭔가Tracker.autorun()의 개체 속성에 액세스 할 수 없습니다.
Tracker.autorun(function() { if (Meteor.user()) { Me = FacebookCollections.getCollection("/me/accounts"); } });
Tracker.autorun(function() { if (Meteor.user() && Me) { Account = Me.find().fetch()[0]; console.log(Account); // this works console.log(Account.id); // this doesn't } });
있습니까 : 나는
여기 내 코드의 Uncaught TypeError: Cannot read property 'id' of undefined
를 얻을?
가능한 오타 @ 오타 가능성이 높습니다,'Account._id'되어야한다? – imslavko
Nope. 그것은 Account.id입니다. 'if (Account)'로 검사하여 작동하도록했습니다. 감사. –