Can you highlight the difference between these two code snippets?
function Ctrl($scope) {
$scope.$watch(function() {
return this.variable;
}.bind(this), /*...*/);
}
and
function Ctrl($scope) {
$scope.$watch(angular.bind(this, function() {
return this.variable;
}, /*...*/);
}
To me, they seem similar, but is there any particular advantage of using angular.bind
?