REMINDER: This method may not function properly if the View and Controller are intertwined within a route or directive definition object. The following solution is effective only when "SomeController as SomeCtrl" is specified in the HTML. As pointed out by Mark V. in the comment below, it's advisable to follow the approach suggested by Bogdan.
In my implementation, I start the controller with var vm = this;
to avoid any confusion with the keyword "this." Then, I assign vm.name = 'Max';
, and in the watch function, I use return vm.name
. Similar to @Bogdan's usage of "self," I utilize "vm" for consistency. This variable, whether named "vm" or "self," is necessary because the context of "this" changes within the function (thus, returning this.name wouldn't be effective). Additionally, remember to inject $scope in your elegant "controller as" solution to access $watch. For further guidance, refer to John Papa's Style Guide: https://github.com/johnpapa/angularjs-styleguide#controllers
function SomeController($scope, $log) {
var vm = this;
vm.name = 'Max';
$scope.$watch('vm.name', function(current, original) {
$log.info('vm.name was %s', original);
$log.info('vm.name is now %s', current);
});
}