Ng-change not working on widget

Prem13
Tera Contributor

Im using ng-change to get the value which is selected but its throwing error

<div>
  
<select name="versions" ng-modal="versions" ng-change="c.passversion(versions)" class="custom-select">
    <option selected>----Select Version----</option>
    <option value="value1">V1</option>
    <option value="value2">V2</option>
    <option value="value3">V3</option>
  </select>
</div>
c.passversion=function(versionss){
		alert(versionss);
	}
1 ACCEPTED SOLUTION

Sai Shravan
Mega Sage

Hi @Prem13 ,

The issue with your code is that you have misspelled the attribute name in the select element. Instead of "ng-modal", it should be "ng-model". This is causing the value to not be properly bound to the variable "versions" in your controller.

 

Regards,

Shravan.

Please mark this as helpful and correct answer, if this helps you

Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you

View solution in original post

1 REPLY 1

Sai Shravan
Mega Sage

Hi @Prem13 ,

The issue with your code is that you have misspelled the attribute name in the select element. Instead of "ng-modal", it should be "ng-model". This is causing the value to not be properly bound to the variable "versions" in your controller.

 

Regards,

Shravan.

Please mark this as helpful and correct answer, if this helps you

Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you