Hello there!
I’m currently having an issue with my Meteor/Angular1 app.
I have an angular controller subscribing to a meteor publication like this:
angular.module("myapp").controller('DesktopCtrl', function($scope, $reactive) {
$reactive(this).attach($scope);
// Subscriptions
this.subscribe('desktopItems');
this.helpers({
items: function() {
return Items.find()
}
});
})
On the server, my publication is like this:
Meteor.publish("desktopItems", function () {
var items = Items.find({ desktopOwner: this.userId });
console.log("publish desktopItems", this.userId, items.count());
return items;
});
It works perfectly, and I can add items directly in MongoDB then they appear in the browser.
BUT ! It doesn’t work just after I log in. When this is the case, I can see the log message appear in the meteor console, saying there is indeed a valid userId, and that items.count()
is greater than zero, but in my helper, the find
method returns an empty cursor. All I can do to get it to work is to reload the page…
Any idea what I did wrong?
Thanks