Can anyone explain why only the first $watch below is firing within the same controller? Both the inputs are text boxes with each ng-model assigned. (thanks in advance)
$scope.$watch('search', function() {
if ($scope.watch !== ""){
var filter = "{'name':{'$regex':'(?i).*"+$scope.search+".*'}}";
fetch(filter);
};
});
$scope.$watch('id', function() {
if ($scope.id !== ""){
var filter = "{'id':{'$regex':'(?i).*"+$scope.id+".*'}}";
fetch2(filter);
};
});
console.log's within each watcher & condition statement?$scope.watchin yourifstatement. Did you mean$scope.search?