rgantla
rgantla

Reputation: 1956

(change) event does not work on select and input elements but does on checkbox Angular 6, Material 6

After updating my project from Material v5.2.4 to v6.0.0 and Angular v5.1.2 to v6.0.0, the (change) event doesn't work on select and input type="text" elements while it does work fine on a checkbox element.

Note: changing the event from (change) to (ngModelChange) is working perfectly fine for all the above specified elements. Also, the (change) event was working just fine before the upgrade on all of them.

StackBlitz to reproduce the issue => HERE

ng -v command result:

Angular CLI: 6.0.0
Node: 8.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Upvotes: 1

Views: 2095

Answers (1)

Pengyy
Pengyy

Reputation: 38161

MatSelect exposes selectionChange to emit select's change event, use selectionChange event instead of change event, see APIs.

refer demo.

Upvotes: 4

Related Questions