I'm having an issue where only the first $watch function is firing in the same controller. Both inputs have ng-model assigned to them. Can someone help me understand why this is happening? (appreciate any help)
$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);
};
});