From you description it sounds like what you’re rendering doesn’t come from a reactive source, i.e. it doesn’t update when the source updates. Without more details I can’t really know what’s going on.
I managed to get it working. I had forgotten to use the Tracker.autorun() function. I also had posted the wrong code above (sorry), I was actually loading finding the documents then looping through them and sorting them into two separate categories like:
this.entities = Entities.find({ "job.jobId": this.jobId }).forEach((item) => {
if (idx == 0) {
this.first = item;
}
// sort into assets and shots
if (item.type === 'asset') {
this.assets.push(item);
}
else if (item.type === 'shot') {
this.shots.push(item);
}
idx += 1;
});
If I remove the foreach and then do my ngFor over the ‘entities’ variable it now works (with Tracker.autorun()). Is there a way I could keep the method above (with the foreach) and make it reactive?
im struggling to do it any other way since I can’t use ngIf on the same element as ngFor so I can’t sort them at that stage, so could someone help me get the above code working and reactive? Unless there is a better way of doing this?
It seems, in my case that ‘entities’ is fully reactive - as soon as I submit my form to insert a new document it pops up straight away. With ‘assets’ and ‘shots’ it doesn’t, but it does show up if I click inside a different field of the form… Is this because of the ngModel is somehow causing angular to update? Just for the sake of clarity, this is my component now: