Watching a single property in an array in AngularJS

A typescript example that converts the array’s property into a single string that can be watched.
        $scope.$watch(
() => this.someArray.map(x => x.selected ? "1" : "0").join(""),
(newValue, oldValue, scope) => this.onSelectionChanged(this.getSelectedItems()));

Comments

Leave a Reply

Your email address will not be published.