diff --git a/demo/src/app/components/+typeahead/demos/form/form.html b/demo/src/app/components/+typeahead/demos/form/form.html new file mode 100644 index 0000000000..5f3111dc9e --- /dev/null +++ b/demo/src/app/components/+typeahead/demos/form/form.html @@ -0,0 +1,14 @@ +
Model: {{model | json}}
+ +
+
+ + +
+
+ + +
+
diff --git a/demo/src/app/components/+typeahead/demos/form/form.ts b/demo/src/app/components/+typeahead/demos/form/form.ts new file mode 100644 index 0000000000..3c4283d3e9 --- /dev/null +++ b/demo/src/app/components/+typeahead/demos/form/form.ts @@ -0,0 +1,64 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-typeahead-form', + templateUrl: './form.html' +}) +export class DemoTypeaheadFormComponent { + model = { + address: '312 Sundown Lane', + state: null + }; + states: string[] = [ + 'Alabama', + 'Alaska', + 'Arizona', + 'Arkansas', + 'California', + 'Colorado', + 'Connecticut', + 'Delaware', + 'Florida', + 'Georgia', + 'Hawaii', + 'Idaho', + 'Illinois', + 'Indiana', + 'Iowa', + 'Kansas', + 'Kentucky', + 'Louisiana', + 'Maine', + 'Maryland', + 'Massachusetts', + 'Michigan', + 'Minnesota', + 'Mississippi', + 'Missouri', + 'Montana', + 'Nebraska', + 'Nevada', + 'New Hampshire', + 'New Jersey', + 'New Mexico', + 'New York', + 'North Dakota', + 'North Carolina', + 'Ohio', + 'Oklahoma', + 'Oregon', + 'Pennsylvania', + 'Rhode Island', + 'South Carolina', + 'South Dakota', + 'Tennessee', + 'Texas', + 'Utah', + 'Vermont', + 'Virginia', + 'Washington', + 'West Virginia', + 'Wisconsin', + 'Wyoming' + ]; +} diff --git a/demo/src/app/components/+typeahead/demos/index.ts b/demo/src/app/components/+typeahead/demos/index.ts index 3ef9a72143..ca3887122e 100644 --- a/demo/src/app/components/+typeahead/demos/index.ts +++ b/demo/src/app/components/+typeahead/demos/index.ts @@ -2,20 +2,22 @@ import { DemoTypeaheadStaticComponent } from './static/static'; import { DemoTypeaheadItemTemplateComponent } from './item-template/item-template'; import { DemoTypeaheadFieldComponent } from './field/field'; import { DemoTypeaheadAsyncComponent } from './async/async'; -import { DemoTypeaheadFormsComponent } from './in-form/in-form'; +import { DemoTypeaheadReactiveFormComponent } from './reactive-form/reactive-form'; import { DemoTypeaheadGroupingComponent } from './grouping/grouping'; import { DemoTypeaheadDropupComponent } from './dropup/dropup'; import { DemoTypeaheadScrollableComponent } from './scrollable/scrollable'; +import { DemoTypeaheadFormComponent } from './form/form'; export const DEMO_COMPONENTS = [ DemoTypeaheadStaticComponent, DemoTypeaheadItemTemplateComponent, DemoTypeaheadFieldComponent, DemoTypeaheadAsyncComponent, - DemoTypeaheadFormsComponent, + DemoTypeaheadReactiveFormComponent, DemoTypeaheadGroupingComponent, DemoTypeaheadDropupComponent, - DemoTypeaheadScrollableComponent + DemoTypeaheadScrollableComponent, + DemoTypeaheadFormComponent ]; export const DEMOS = { @@ -35,9 +37,13 @@ export const DEMOS = { component: require('!!raw-loader?lang=typescript!./async/async.ts'), html: require('!!raw-loader?lang=markup!./async/async.html') }, - inForm: { - component: require('!!raw-loader?lang=typescript!./in-form/in-form.ts'), - html: require('!!raw-loader?lang=markup!./in-form/in-form.html') + form: { + component: require('!!raw-loader?lang=typescript!./form/form.ts'), + html: require('!!raw-loader?lang=markup!./form/form.html') + }, + reactiveForm: { + component: require('!!raw-loader?lang=typescript!./reactive-form/reactive-form.ts'), + html: require('!!raw-loader?lang=markup!./reactive-form/reactive-form.html') }, grouping: { component: require('!!raw-loader?lang=typescript!./grouping/grouping.ts'), diff --git a/demo/src/app/components/+typeahead/demos/in-form/in-form.html b/demo/src/app/components/+typeahead/demos/reactive-form/reactive-form.html similarity index 91% rename from demo/src/app/components/+typeahead/demos/in-form/in-form.html rename to demo/src/app/components/+typeahead/demos/reactive-form/reactive-form.html index be305c2b5c..d24d477cd3 100644 --- a/demo/src/app/components/+typeahead/demos/in-form/in-form.html +++ b/demo/src/app/components/+typeahead/demos/reactive-form/reactive-form.html @@ -1,5 +1,5 @@ -
Model: {{myForm.value.state | json}}
+
+ Typeahead can be used in template-driven forms. Keep in mind that value of ngModel is string +

+ `, + component: require('!!raw-loader?lang=typescript!./demos/form/form.ts'), + html: require('!!raw-loader?lang=markup!./demos/form/form.html'), + outlet: DemoTypeaheadFormComponent + }, { title: 'Reactive forms', anchor: 'reactive-forms', - component: require('!!raw-loader?lang=typescript!./demos/in-form/in-form.ts'), - html: require('!!raw-loader?lang=markup!./demos/in-form/in-form.html'), - outlet: DemoTypeaheadFormsComponent + description: ` +

Typeahead can be used in reactive forms. Keep in mind that value of ngModel is string

+ `, + component: require('!!raw-loader?lang=typescript!./demos/reactive-form/reactive-form.ts'), + html: require('!!raw-loader?lang=markup!./demos/reactive-form/reactive-form.html'), + outlet: DemoTypeaheadReactiveFormComponent }, { title: 'Grouping results', diff --git a/demo/src/ng-api-doc.ts b/demo/src/ng-api-doc.ts index bc6c546826..368236eb24 100644 --- a/demo/src/ng-api-doc.ts +++ b/demo/src/ng-api-doc.ts @@ -776,7 +776,7 @@ export const ngdoc: any = { "BsDatepickerConfig": { "fileName": "src/datepicker/bs-datepicker.config.ts", "className": "BsDatepickerConfig", - "description": "

For date range picker there are BsDaterangepickerConfig which inherits all properties,\nexcept displayMonths, for range picker it default to 2

\n", + "description": "

For date range picker there are BsDaterangepickerConfig which inherits all properties,\nexcept displayMonths, for range picker it default to 2

\n", "methods": [], "properties": [ {