我正在为我的项目使用 angular-meteor。当我删除“自动发布”并为我的集合添加发布方法时,当我尝试获取任何数据时,我在控制台中收到以下错误。
Exception in queued task: TypeError: Cannot read property 'splice' of undefined
at Object.addedAt (http://localhost:3000/packages/angular-meteor-data.js?36dfe4bee5b3da21eaa0d9bc0366addac4788a1a:2191:24)
at observeChangesCallbacks.addedBefore (http://localhost:3000/packages/minimongo.js?cdf1a26cf7719fa9471a8017c3defd5aea812727:3623:28)
at Object.self.applyChange.addedBefore (http://localhost:3000/packages/minimongo.js?cdf1a26cf7719fa9471a8017c3defd5aea812727:3560:56)
at http://localhost:3000/packages/minimongo.js?cdf1a26cf7719fa9471a8017c3defd5aea812727:407:13
at _.extend.runTask (http://localhost:3000/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:685:11)
at _.extend.flush (http://localhost:3000/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:713:10)
at _.extend.drain (http://localhost:3000/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4:721:12)
at LocalCollection.insert (http://localhost:3000/packages/minimongo.js?cdf1a26cf7719fa9471a8017c3defd5aea812727:615:22)
at Object.self._connection.registerStore.update (http://localhost:3000/packages/mongo.js?69942a86515ec397dfd8cbb0a151a0eefdd9560d:250:28)
at Object.store.(anonymous function) [as update] (http://localhost:3000/packages/ddp-client.js?250b63e6c919c5383a0511ee4efbf42bb70a650f:3555:48)
很久以来我一直在尝试解决这个问题,但找不到任何解决方案。
我的控制器代码:
controllerAs: 'dash',
controller: function($scope, $reactive, $state) {
$reactive(this).attach($scope);
this.subscribe('sheets');
this.helpers({
sheets: () => {
return Sheets.find({});
}
});
}
}
并发布代码:
if (Meteor.isServer) {
Meteor.publish("sheets", function () {
return Sheets.find({});
});
}
当我将“自动发布”添加到项目时,我没有收到错误