Skip to content

Commit a5ecad5

Browse files
committed
fix(instrumentation): fix patchin provider object with array properties
1 parent c002d05 commit a5ecad5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

js/inject/debug.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,22 @@ var inject = function () {
682682
$provide[met] = function (name, definition) {
683683
if (typeof name === 'object') {
684684
angular.forEach(name, function (value, key) {
685-
name[key] = function () {
685+
var isArray = value instanceof Array;
686+
var originalValue = isArray ? value[value.length - 1] : value;
687+
688+
var newValue = function () {
686689
debug.deps.push({
687690
name: key,
688-
imports: annotate(value)
691+
imports: annotate(originalValue)
689692
});
690-
return value.apply(this, arguments);
693+
return originalValue.apply(this, arguments);
691694
};
695+
696+
if (isArray) {
697+
value[value.length - 1] = newValue;
698+
} else {
699+
name[value] = newValue;
700+
}
692701
});
693702
} else {
694703
debug.deps.push({

0 commit comments

Comments
 (0)