<h3>Cause</h3>
<div class="row">
<div class="form-group col-md-6">
{{> inputAutocomplete settings=autocompleteSettings id="cause" name="cause" class="form-control" placeholder="Cause name..."}}
</div>
</div>
Template.createPayment.helpers
autocompleteSettings: ->
position: 'bottom'
limit: 10
rules: [
{
collection: Cause,
field: "name",
matchAll: true,
subscription: 'causes',
template: Template.cause
}
]
Meteor.publish 'causes', (selector, options) ->
console.log 'Subscribing to causes'
collection = Cause
sub = this
# guard against client-side DOS: hard limit to 50
options.limit = Math.min(50, Math.abs(options.limit)) if options.limit
# Push this into our own collection on the client so they don't interfere with other publications of the named collection.
console.log("SELECTOR #{selector}")
handle = collection.find(selector, options).observeChanges
added: (id, fields) ->
sub.added("autocompleteRecords", id, fields)
changed: (id, fields) ->
sub.changed("autocompleteRecords", id, fields)
removed: (id) ->
sub.removed("autocompleteRecords", id)
sub.ready()
sub.onStop -> handle.stop()
I never see the console.log output from the subscription, so I am thinking I did something wrong there? I see the autocomplete come up after I type 2 letters I see the 'no matches' message, so I know some of it is working.