An add-on Meteor package for aldeed:autoform. Provides a single custom input type, "typeahead", which renders an input using the typeahead plugin.
The plugin library must be installed separately.
In a Meteor app directory, enter:
$ meteor add comerc:bs-typeahead
$ meteor add aldeed:autoform
In a Meteor app directory, enter:
$ meteor add comerc:autoform-typeahead
Specify "typeahead" for the type
attribute of any input. This can be done in a number of ways:
In the schema, which will then work with a quickForm
or afQuickFields
:
{
tags: {
type: String,
autoform: {
type: "typeahead",
afFieldInput: {
typeaheadOptions: {},
typeaheadDatasets: {}
}
}
}
}
Or on the afFieldInput
component or any component that passes along attributes to afFieldInput
:
{{> afQuickField name="tags" type="typeahead"}}
{{> afFormGroup name="tags" type="typeahead"}}
{{> afFieldInput name="tags" type="typeahead"}}
To provide typeahead options, set a typeaheadOptions
attribute equal to a helper that returns the options object. Most of the data-
attributes that the plugin recognizes should also work.
You may use autoform.options
(instead of typeaheadDatasets
) like this example:
{
tags: {
type: String,
autoform: {
type: "typeahead",
options: {
'value1': 'label1',
'value2': 'label2'
}
}
}
}
Anyone is welcome to contribute. Fork, make your changes, and then submit a pull request.