This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Old values in $watchGroup's callback is not correct. #16004
Closed
Description
I'm submitting a ...
- bug report
- feature request
- other (Please do not submit support requests here (see above))
Current behavior:
Old values in $watchGroup's parameters is not correct.
Expected / new behavior:
Correct values.
Minimal reproduction of the problem with instructions:
<input id="input1" ng-model="t1" ng-change="t2=t1">
<input id="input2" ng-model="t2">
<script>
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.$watchGroup(['t1', 't2'], function(nvals, ovals) {
console.log('nvals:' + angular.toJson(nvals) + ', ovals:' + angular.toJson(ovals))
});
});
</script>
Steps:
- initial state
log: [null,null], ovals:[null,null] - type "a" in input1
log: nvals:["a","a"], ovals:[null,null] - type "b" in input2
log: nvals:["a","b"], ovals:[null,"a"] (??? ovals expect to be ["a","a"] but not.)
plunker:
https://plnkr.co/edit/slDfDzwvGT6jrZtn42C9?p=preview
Angular version: 1.6.4
Browser: all
Anything else: