html - Angularjs value not updating -
i know similar questions have been asked don't apply case. have defined variables in controller , display values in panel. controller related part this:
var vm = this; vm.wellid = "id"; vm.wellseq = "sequence"; vm.onwellselected = onwellselected; ... function onwellselected(wells) { ... vm.wellid = wells[0]["id"]; vm.wellseq = wells[0]["sequence"]; ... }
and html component this:
<div plate id="plate-layout" on-well-selected="vm.onwellselected(wells)"> </div> <ul class="list-group" style="width: 400px; overflow: auto"> <li class="list-group-item">{{vm.wellid}}</li> <li class="list-group-item">{{vm.wellseq}}</li> </ul>
i checked source , set break points in function onwellselected: vm.wellid , vm.wellseq indeed changed correct values after operation, new value cannot displayed. definition of plate involves quite number of other js files not easy show here, plate directive, support 2 services. reasons? thanks!
sorry i'm new angular took me while find this:
$scope.$apply();
put after modification part , value updated on page.
edit:
just follow-up: if use this: $scope.$apply() or $scope.$digest(), i'll error: $digest in progress; if remove it, value won't updated. refer post here: prevent error, , it's working fine without error message. hope can facing same issue.
Comments
Post a Comment