I am creating multiple drop downs dynamically using a json file as a configuration for my application. Everything seems to work fine but I cant observe the output-model of each control using the $watchCollection funciton. Here is my code
...
```
$scope.getoutput_data = function (filter) {
$scope[filter.id + '_menu_output_data'] = [];
$scope.$watchCollection(
function getValue() {
return $scope[filter.id + '_menu_output_data'];
},
function (newValue, oldValue) {
console.log(
"New value: %s , Was value: %s.",
JSON.stringify(newValue),
JSON.stringify(oldValue)
);
}
);
return $scope[filter.id + '_menu_output_data'];
}
```
I am creating multiple drop downs dynamically using a json file as a configuration for my application. Everything seems to work fine but I cant observe the output-model of each control using the $watchCollection funciton. Here is my code
Very interesting. Let me build a demo and try it
I had time to test your code and it's working fine here. https://plnkr.co/edit/5vrRIWqT66PrJRZCPKwQ?p=preview
Are you sure
filter.id
contains a valid value? Also, what version of Angular are you using?It was my mistake. I am still new to angular. I noticed a new scope was created during ng-repeat.
Ok, I'll close the issue then.