angularjs - ngmodel undefined but $modelValue and $viewValue changed -
generally html likes below:
<script type="text/javascript" src="assets/txn/test/test.js"></script> <script type="text/javascript" src="assets/txn/test/test_newao.js"></script> <script type="text/javascript" src="assets/txn/test/test_confirm.js"></script> <div ng-controller="testcontroller" ng-cloak> <div class="panel panel-default"> <div class="bootstrap-admin-panel-content search_box"> <form name="myform"> <table style="width:90%;"> <tr> <th style = "width : 10%;">a:</th> <td style = "width : 40%"> <e-combobox ng-model = "inputvo.brchid" ng-datasource = "branch_list" ng-validate = "true" ng-disabled = "false" ng-editable = "false" ng-format = "f3" ng-change = "brchchange()" placeholder="請選擇..."/> </td> <th style = "width : 10%;">b:</th> <td style = "width : 40%"> <e-combobox ng-model = "inputvo.aocode" ng-datasource = "ao_list" ng-validate = "true" ng-disabled = "false" ng-editable = "false" ng-format = "f3" ng-required = "false"/> <input name="test" type = "checkbox" ng-disabled = "testvo.condid != '2' && testvo.condid != '15'" style = "vertical-align : middle;" ng-model = "isdismission" ng-change = "showdismission()">check </td> </tr> </table> </form> </div> </div> </div>
in testcontroller, showdismission defined as:
$scope.showdismission = function() { alert($scope.isdismission); alert($scope.myform.test.$viewvalue); alert($scope.myform.test.$modelvalue); }
when click checkbox,the first statement alerts undefined,the other 2 alert correct boolean value. when change ng-model inputvo.isdismission , alert $scope.inputvo.isdismission,it works well. seems it's different scopes between ngmodel , testcontroller in html.but can't find it.anyone please tell me i've missed. angular.js version 1.5.8.
Comments
Post a Comment