-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datepicker): add onTouched support, add forms demos, split demos…
… for old and new datepicker
- Loading branch information
1 parent
16affdd
commit 17405b7
Showing
10 changed files
with
218 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
demo/src/app/components/+datepicker/demos/forms/forms.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
<input type="text" bsDatepicker [(ngModel)]="datepickerModel" /> | ||
<input type="text" bsDaterangepicker [(ngModel)]="daterangepickerModel" /> | ||
<div class="row"> | ||
<div class="col-xs-3 form-group"> | ||
<input type="text" class="form-control" placeholder="Datepicker" bsDatepicker [(ngModel)]="datepickerModel" /> | ||
</div> | ||
<div class="col-xs-3 form-group"> | ||
<input type="text" class="form-control" placeholder="Daterangepicker" bsDaterangepicker [(ngModel)]="daterangepickerModel" /> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<pre>{{datepickerModel}}<br>{{daterangepickerModel}}</pre> | ||
</div> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
demo/src/app/components/+datepicker/demos/reactive-forms/reactive-forms.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="row"> | ||
<form [formGroup]="myForm"> | ||
<div class="col-xs-3 form-group"> | ||
<input type="text" class="form-control" placeholder="Datepicker" bsDatepicker formControlName="date" /> | ||
</div> | ||
<div class="col-xs-3 form-group"> | ||
<input type="text" class="form-control" placeholder="Daterangepicker" bsDaterangepicker formControlName="range" /> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<pre>{{myForm.value | json}}</pre> | ||
</div> | ||
</div> | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
demo/src/app/components/+datepicker/demos/reactive-forms/reactive-forms.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { FormBuilder, FormGroup } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'demo-datepicker-reactive-forms', | ||
templateUrl: './reactive-forms.component.html' | ||
}) | ||
export class DemoDatepickerReactiveFormsComponent implements OnInit { | ||
myForm: FormGroup; | ||
constructor(private formBuilder: FormBuilder) { } | ||
|
||
ngOnInit() { | ||
this.myForm = this.formBuilder.group({ | ||
date: null, | ||
range: null | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
```typescript | ||
// RECOMMENDED (doesn't work with system.js) | ||
import { DatepickerModule } from 'ngx-bootstrap/datepicker'; | ||
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; | ||
// or | ||
import { DatepickerModule } from 'ngx-bootstrap'; | ||
import { BsDatepickerModule } from 'ngx-bootstrap'; | ||
|
||
@NgModule({ | ||
imports: [DatepickerModule.forRoot(),...] | ||
imports: [BsDatepickerModule.forRoot(),...] | ||
}) | ||
export class AppModule(){} | ||
export class AppModule(){} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
```typescript | ||
// RECOMMENDED (doesn't work with system.js) | ||
import { DatepickerModule } from 'ngx-bootstrap/datepicker'; | ||
// or | ||
import { DatepickerModule } from 'ngx-bootstrap'; | ||
|
||
@NgModule({ | ||
imports: [DatepickerModule.forRoot(),...] | ||
}) | ||
export class AppModule(){} | ||
``` |
Oops, something went wrong.