From 05c49a4c480a34bb8be9f5c2f2ad4fc63c4403a1 Mon Sep 17 00:00:00 2001 From: praneethkumarpidugu Date: Mon, 4 Jul 2016 23:20:20 -0400 Subject: [PATCH] watch scope variables for changes --- section6/lesson1/main.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/section6/lesson1/main.js b/section6/lesson1/main.js index cc0966c..0f8ed30 100644 --- a/section6/lesson1/main.js +++ b/section6/lesson1/main.js @@ -28,13 +28,9 @@ app.controller('PersonListController', function ($scope, ContactService) { $scope.contacts.loadMore(); }; - $scope.sensitiveSearch = function (person) { - if ($scope.search) { - return person.name.indexOf($scope.search) == 0 || - person.email.indexOf($scope.search) == 0; - } - return true; - }; + $scope.$watch('search', function(newVal, oldVal) { + console.log(newVal); + }) });