Skip to content
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
@tobyee

Description

@tobyee

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:

  1. initial state
    log: [null,null], ovals:[null,null]
  2. type "a" in input1
    log: nvals:["a","a"], ovals:[null,null]
  3. 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:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions