Components: datepick doesn't work properly in form

Created on 13 May 2017  路  1Comment  路  Source: angular/components

Bug, feature request, or proposal:

bug

What is the expected behavior?

when i click the calendar button, pop up the calendar,and select the date

What is the current behavior?

when i click the calendar button, the form ngSubmit function will be exec

What are the steps to reproduce?

just put a Datepicker component in form

<md-dialog-content>
    <form (ngSubmit)="onSubmit()" #dialogForm="ngForm"> 
        <md-input-container>
            <input mdInput [mdDatepicker]="myDatepicker" name="mydatep">
            <button mdSuffix [mdDatepickerToggle]="myDatepicker"></button>
        </md-input-container>
        <md-datepicker #myDatepicker [touchUi]="true"></md-datepicker>      

        <md-dialog-actions [attr.align]="actionsAlignment">
            <button md-raised-button color="primary" md-dialog-close (click)="dialogClose()"> Close </button>
            <button type="submit" md-raised-button color="accent" [disabled]="!dialogForm.form.valid"> OK </button>
        </md-dialog-actions>   
    </form>
</md-dialog-content>

What is the use-case or motivation for changing an existing behavior?

It isn't working properly in form, and it is work properly outside form

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.2.0-beta.0
material 2.0.0-beta.5
os win10
typescript 2.3.1
Browsers: Chrome 58.0.3029.110 (64-bit)

Is there anything else we should know?

has pr

Most helpful comment

I Fix that problem using type attribute in button date picker

>All comments

I Fix that problem using type attribute in button date picker

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hiblton picture Hiblton  路  3Comments

3mp3ri0r picture 3mp3ri0r  路  3Comments

julianobrasil picture julianobrasil  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

Miiekeee picture Miiekeee  路  3Comments