As I work on integrating trNgGrid into my angular app, the challenge arises when attempting to bind a function from the controller to an ng-click
on a row. This difficulty stems from the fact that the table body is built by itself. The solution proposed in the documentation suggests using $watch
on an array within the $scope
for tracking changes. While I understand the concept of $scope
, it's not often necessary to utilize it when working with TypeScript and the ControllerAs
syntax. So, my inquiry is: what exactly gets stored on the $scope
and how do I properly monitor it?
In the given example:
export class DummyViewModel {
private iAmPrivate : number;
public iAmPublic: number;
constructor($scope : any) {
$scope.amIOnTheScope = "??";
}
}
Are iAmPrivate
and iAmPublic
present on the $scope
? Can I keep an eye on changes to iAmPublic
using $scope.$watch("iAmPublic",...
? Moreover, if I access a public member of the controller from the view using vm.iAmPublic
, where does this link back to? Does it connect to the $scope
or some hidden realm of the controller?