Mat autocomplete input change event bleeds 'event' object
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/material 9.1.2
Is this a regression?
not sure.
Description
The event (change)
will pass down an “event” object to the handler, even if it’s not specified as a parameter.
🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-x78zg6
see the autocomplete-overview-example.html
lines 6-7, and their correspoding hander on autocomplete-verview-example.ts
lines 65-72.
🔥 Exception or Error
console.log shows that we have an “event” object, although it is not defined in the function parameter list.
🌍 Your Environment
Angular Version: see stackblitz dependencies.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Angular material auto complete change event not called when ...
I was set the value to the auto-complete component on ngOnInint method that time i want to call one method based on the...
Read more >Autocomplete | Angular Material
MatAutocompleteSelectedEvent. Event object that is emitted when an autocomplete option is selected. Properties. Name, Description.
Read more >disable and enable a button based on condition react js
And updated the value of activityChanged on onChange event of text input as shown below. const handleInputChange = ( event: FormEvent<HTMLInputElement ...
Read more >Buttons - Bootstrap
Use Bootstrap's custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
Read more >Angular Material Autocomplete Select Option Event Example
In this example, you will learn angular material autocomplete change event. This post will give you simple example of angular material ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@KissBalazs thnx for the additional clarifications! You are totally right to be confused as to why one can access
event
! It turns out, though, that it is not Angular specific but you are bumping into https://developer.mozilla.org/en-US/docs/Web/API/Window/eventThe long story short that browsers will expose
event
(for the event being processed) on the window. Since window acts as a global in the browser environment, you can access it in your event handler. You would observe the same effect Angular or not.Going to close this one as it is not specific to Angular but rather to how browsers work. But hey, totally see how this could be confusing!
After a quick scan it looks like a duplicate of #4059 where we’ve got a conflict between the
(change)
event on an<input>
and thechange
event raised by a directive. Needs more investigation.