From 8f72907c881db4e6099fd3e607f53460ecf68f6d Mon Sep 17 00:00:00 2001 From: Gil Hanan Date: Thu, 22 Sep 2016 13:15:35 +0300 Subject: [PATCH] $watch controller memebers independent controllerAs allias watching controller members should not be depend on chosen controllerAs alias name, it's hard to maintenance, and can make confusing by using multiple instance of controller. --- a1/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/a1/README.md b/a1/README.md index edbbef19..fa28721c 100644 --- a/a1/README.md +++ b/a1/README.md @@ -414,7 +414,9 @@ While this guide explains the *what*, *why* and *how*, I find it helpful to see var vm = this; vm.title = 'Some Title'; - $scope.$watch('vm.title', function(current, original) { + $scope.$watch(function(){ + return vm.title; + }, function(current, original) { $log.info('vm.title was %s', original); $log.info('vm.title is now %s', current); });