Ng-change does not call method and no errors are displayed

I am working on angularjs application. I have radio buttons based on radio button selection, I need to show the results. The problem is when I change the radio button it is not a js code call. It is possible to trace the error / problem and no errors are displayed on the console. Below I share all the code, any suggestions would be helpful.

HTML:

    <table>
    <tr>
    One <input type="radio" ng-model="value" value="foo" ng-change='newValue(value)'> <br>
    Two: <input type="radio" ng-model="value" value="bar" ng-change='newValue(value)'>
    </tr>

    </table>

      

+3


source to share


1 answer


Angular doesn't recognize yours ng-model

or ng-change

because yours <tr>

doesn't contain <td>

. Just wrap inputs

in <td>

and it should work:



<tr>
    <td>
        ALL <input type="radio" ng-model="value" value="foo" ng-change='newValue(value)'> <br>
        Laptop,desktop,server: <input type="radio" ng-model="value" value="bar" ng-change='newValue(value)'>
    </td>
</tr>

      

0


source







All Articles