Many greetings,
Working on a webapp and for some reason, the documents in my collection aren’t loading unto the webapp on the browser
this is my HTML code
<body>
<div class="container">
<header>
<h1 class="js-test">THE FARMERS' MARKET.ng</h1>
</header>
<form class="js-add-product">
<input type="" name="product_image" placeholder="Insert product image"><br>
<input type="" name="product_name" placeholder="Insert product name"><br>
<input type="" name="product_price" placeholder="Insert price for product"><br>
<input type="" name="product_description" placeholder="Insert detailed description of product"><br>
<button class="btn btn-success">Save</button>
</form>
</div>
<hr>
<div class="container">
{{> product}}
</div>
</body>
<template name="product">
<div class="row">
{{#each product}}
<div class="col-xs-6 col-md-3">
<div class="thumbnail">
<img src="{{product_image}}" alt="{{product_name}}" class="css-image">
<div class="caption">
<h3>{{product_name}}</h3>
<p>{{product_price}}</p>
<button class="btn btn-default">Add to Cart</button>
</div>
</div>
</div>
{{/each}}
</div>
</template>
and the JS code:
import { Template } from 'meteor/templating';
import { Store } from '../api/store.js';
import './body.html';
Template.body.events({
'click .js-test':function (events) {
console.log("Hello there...");
},
'submit .js-add-product':function(event){
var image, name, price, description;
image = event.target.product_image.value;
name = event.target.product_name.value;
price = event.target.product_price.value;
description = event.target.product_description.value;
//console.log("Image: "+image+" Product: "+name+" Price: "+price+" Details: "+description);
Store.insert ({
product_image: image,
product_name: name,
product_price: price,
product_description: description,
createdOn: new Date(),
//createdBy: Meteor.user()._id
});
return false;
},
});
Template.product.helpers({
store() {
return Store.find({});
},
});
I have failed to see why the objects in the collection will not display, can anyone help me point out where I am wrong…?
PS, I’m fairly new to coding