I used mat-menu in a <form>. When I clicked the mat-menu button, it triggered the mat-menu, but also triggered the form submit.
It should only trigger the mat-menu, and don't trigger the form submit.
It triggered the mat-menu, and also triggered the form submit.
I was not used mat-menu for menu. I used mat-menu in a form control for user to quick select some items into the text field.
Angular CLI: 1.7.2
Node: 8.4.0
OS: darwin x64
Angular: 5.2.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.7.2
@angular/flex-layout: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.1
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0
I resolved it.
I add type="button" to mat-menu button.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
I resolved it.
I add
type="button"to mat-menu button.