Topic: How to code select two way binding using angular 2 components pro asked 5 years ago

I am trying like this.
In component.html
<mdb-select [options]="surahSelect" placeholder="సూరహ్" (change)="onChange($"></mdb-select>

In component.ts

ngOnInit() {

this.surahSelect = [
{ value: '1', label: 'Option 1' },
{ value: '2', label: 'Option 2 444' },


onChange(newValue) {
console.log(newValue);   // ****Not get console output
With default select I am able to get. But with <mdb-select> I am not. Please share the sample example.

Sebastian Kaczmarek staff answered 5 years ago

Hi, reachfrq Material select is different than default one and as such, it behaves differently. If you want to trigger your function on selection change, bind it to selected event instead of change. See example:
<mdb-select [options]="surahSelect" placeholder="సూరహ్" (selected)="onChange($event)"></mdb-select>
Best regards, Sebastian

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No