This repository was archived by the owner on Apr 30, 2018. It is now read-only.
This repository was archived by the owner on Apr 30, 2018. It is now read-only.
HTML datalist #482
Closed
Description
Is it possible for formly to render and correctly use a datalist element? Given the following statement placed in app.run:
formlyConfig.setType({
name: 'datalist',
extends: 'input',
template: '<input class="form-control" type="text" list="{{id}}" ng-model="model[options.key]"><datalist id="{{id}}"><option ng-repeat="value in to.options" value="{{value.value}}</option></datalist>
});
And given the following formly JSON:
{
key: 'somekey',
type: 'datalist',
templateOptions: {
label: 'This is a list of URL's',
type: 'url',
required: true,
options: [
{
value: 'http://someurl.com/'
},
{
value: 'http://anotherurl.com/'
}
],
pattern: 'regex here',
patternUrlMessage: 'Not a valid URL',
description: 'e.g. http://url.com/',
placeholder: ''
},
modelOptions: {}
}
Formly simple renders an input element and excludes the datalist part of the template. Removing ng-model="model[options.key]" out of the input element in the template allows the browser to render the datalist correctly but it obviously doesn't save the input to the Angular model.
Have I missed anything?
Metadata
Metadata
Assignees
Labels
No labels