title: AngularJS watch not working
body: <p>A watch is not working.
  I ng-include the following content:</p>
  
  <pre><code>&lt;form class="search"&gt;
      &lt;div class="searchbar"&gt;
          &lt;input type="search" value="" data-ng-model="searchKeyword" placeholder="zoeken"&gt;
          &lt;button type="submit"&gt;&lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt;&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>like this:</p>
  
  <pre><code>&lt;div ng-include src="filterPath" onload="initiateSearch()"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The onload function is doing this:</p>
  
  <pre><code>(function(){
      var appController = angular.module('ListerAppController', []);
  
      appController.controller('ListerCtrl', ['$scope', '$rootScope', '$http', '$filter', '$timeout', '$sharedFactories', 'History', '$location',
          function($scope, $rootScope, $http, $filter, $timeout, $sharedFactories, History, $location) {
              $scope.initiateSearch = function () {
              // This is what you will bind the filter to
                  $scope.filterText = '';
  
                  // Instantiate these variables outside the watch
                  var tempFilterText = '',
                      filterTextTimeout;
  
                  $scope.$watch('searchKeyword', function (val) {
                      if (filterTextTimeout) $timeout.cancel(filterTextTimeout);
  
                      tempFilterText = val;
  
                      filterTextTimeout = $timeout(function() {
                          $scope.filterText = tempFilterText;
                          $scope.pageCount = function() {
                              return Math.ceil( $scope.itemsfiltered.length / $scope.itemsPerPage );
                      };
                  }, 350); // delay 250 ms
              });
          };
      }]);
  })();
  </code></pre>
  
  <p>Everything seems to go allright but... the $watch on searchKeyword never fires the function when I start typing in the input element called searchKeyword. </p>