Skip to content

datepick doesn't work properly in form #4530

@ghost

Description

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?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions