Using the package
We can use the template from our package in the application. Append the following template call to the header section of ProductsKart.html
:
<div class="bucketContainer">{{> Bucket classes="icon-bucket" name="Cart" text="items" bucketContainer="#bucketPlace"}}</div>
After adding this, the cart division will be displayed in the top-right corner of the application in the browser. Hope you got a fair idea of how the packages work. Let us complete the rest of the package features.
We have created the collection in our package, but haven't published or subscribed it. We will publish the collection in the server by adding the following code to the bucket.js
file inside our package directory:
if(Meteor.isServer) { Meteor.publish("bucket", function() { return BucketCollection.find({}); }); }
We will subscribe for the collection in the same file by adding the following code:
if(Meteor.isClient) { ...