mongodb - Unable to get mizzao/meteor-autocomplete to work with collection -
i using mizzao/meteor-autocomplete , having problems in trying work.
when viewing page in browser, getting no results @ when typing text. i've created appropriate collection:
institutions = new mongo.collection("institutions");
and know there data in actual db, still no success.
i've included files below.
publications.js (located in server folder)
meteor.publish('institutions', function(args) { return institutions.find({}, args); });
registrationstart.js
i've 2 helpers; 1 powers search , other should returning institutions. have tried token: '@'
argument no success.
if (meteor.isclient) { template.registrationstart.helpers({ settings: function() { return { position: "top", limit: 7, rules: [{ collection: institutions, field: "name", options: '', matchall: true, template: template.institutionselectdisplay }] }; }, institutions: function() { return instititions.find(); } }); template.registrationstart.events({ "autocompleteselect input": function(event, template, doc) { // session.set(event.target.name, event.target.value); console.log("selected: ", doc); console.log("event.target.name: ", event.target.name); console.log("event.target.value: ", event.target.value); } }); }
registrationstart.html template
<template name="registrationstart"> <div class="panel-body" id="loginform"> <h2 class="pagetitle">veclient registration</h2> <form> <div> </div> <fieldset> {{> inputautocomplete settings=settings id="institution" class="input-xlarge" placeholder="type institution here"}} </fieldset> <div> </div> <button type="submit" class="btn btn-primary btn-sm">continue registration</button> </form> </div> </template>
and template rendered
<template name="institutionselectdisplay"> <p class="inst-state">{{city}}, {{state}}</p> <p class="inst-name">{{name}}</p> <p class="inst-description">{{email}}</p> </template>
problem resulted because there no subscription "institutions" publication. need add subscribe statement registrationstart.js file:
meteor.subscribe('institutions');
Comments
Post a Comment