Closed popsail closed 3 years ago
This change expects appScope to be a $scope. Passing a vm instead will cause it to fail (it not having $watch function).
For backward-compatibility, we can condition using appScope on it having a $watch function, otherwise using $scope.$parent.
Added commit for backward-compatibility - we now condition watching appScope on it being a valid $scope. In other cases (i.e it is a vm) we revert to watching $scope.$parent.
Seems like appScopProvider: vm use cases don't really get fixed by my solution. Will work on another approach and open a new pull/issue.
This change prevents an issue where combining a string uiGrid.data and wrapping ui-grid with another component causes data not to be watched and evaluated correctly. Seems to me we'd want to watch the variable on appScope, not necessarily ui-grid's direct parent.
Otherwise, when using a wrapped uigrid, we'll have to pass '$parent.data' instead of 'data', which is a leaky abstraction at best.