Comments (8)
@jpgilchrist good question, and for that it is important to understand better how publish/subscribe works in Meteor.
Here is a good article:
http://www.meteorpedia.com/read/Understanding_Meteor_Publish_and_Subscribe
The main thing - minimogo is just for cache, it's not for filtering. it is suppose to contain everything you subscribed to in client, so this behaviour is good.
Filtering should be done by Mongo selectors, like this:
var publicPosts = BlogPosts.find({public: true});
So in our case:
$collection(Items, {public: true}).bind($scope, "publicItems", true, true);
from angular-meteor.
I'm not sure I 100% agree. Because the point especially in regards to mobile applications is to limit the data necessary for the UI to work. Therefore, I do not want all the Items, just the public Items. In this manner, I don't have to filter it further and I don't have to worry about slowing down the client with too much data (obviously more of a scaling problem, which I don't really have to deal with yet - just want to keep it in mind).
from angular-meteor.
So why subscribing to $subscribe.susbcribe("allItems");?
And if you did, it's already there, no need to delete them and it will help you a lot when you do:
$subscribe.subscribe("publicItems"); because it's already there.
In mobile or not in mobile you should subscribe only to what you need.
subscribing fetches the data to the client, ones its there, no need to fetch it again if it's not changed
from angular-meteor.
Makes sense. I 100% agree with you on not fetching data that's already there.
Just seems redundant to have to filter the $collection when you are $subscribing to a specific publication that should already be limited in scope. This means, that I would have to make sure that (on almost all $collections) I reuse the same filter from the publication.
I.e.,
Meteor.publish("publicItems", function() {
Items.find({public: true});
});
$collection(Items, {public: true}).bind(...)
Seems simple with a simple query such as {public: true}
, but what happens when you have to use a more complex query. I'd rather not have to maintain it in two separate locations.
from angular-meteor.
That is the main difference between AngularJS and Meteor.
In Meteor, everything in the client is global, so you can do it once.
In Angular, it is per scope.
If you want to make it global, you can put it in $rootScope
from angular-meteor.
Right. I feel like that's where some of my confusion comes into play. I'm assuming that the $scope will be unique, but it's actually pulling global data from the data cache in mini mongo. Therefore, in the $scope we have to force it to filter.
Thanks for being so responsive. It's much appreciated. Feel free to close.
from angular-meteor.
No problem, those are good questions and they give me more material for the tutorial.
I'll think about how better to explain those differences in the tutorial, would love your thoughts and maybe even your pull requests for the tutorial, I think your perspective would be very valuable to the tutorial
from angular-meteor.
Sounds good. I'll take another read through the tutorial and see if there's any place where I can help.
from angular-meteor.
Related Issues (20)
- ReferenceError: angular is not defined
- Typescript compiler adds arrow function in web.browser.legacy js file causing error on IE11
- Angular Meteor Universal w/ AOT questions HOT 3
- Angular Meteor Universal w/ AOT config
- Problem when compiling project with MeteorCLI
- meteor build mobile app failed File to read not found or unreadable: HOT 1
- Infinite render loop for applications without a <base>
- Using angular-meteor with Meteor 1.8.2 HOT 3
- angular-meteor with Meteor 1.8.2 and ng-table
- HTML optimization during build process HOT 4
- upgrade to Meteor 1.9 fails HOT 19
- Error while compiling in AOT mode with Angular 9 HOT 15
- Client compiling twice every change/build HOT 2
- Upgrade to Meteor 1.10 fails HOT 2
- Bare example fails (with minor tweak) when upgraded to Meteor 1.8.2 HOT 2
- Server Side Rendering(SSR) in Angular CLI + Meteor project
- Testing your template :p
- Error: Cannot find module '/imports/app/app.module'
- `AOT=1 meteor` broken for Angular versions ≥ 13 HOT 3
- Are there any plans to upgrade this project to Angular 17?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-meteor.