I am building a website, using angularJs and mongoDB with restheart, to build a database.
My input is written in this way,
<th><input types="number" ng-model="GeneN" ng-change="change()"></th>
<th><input types="number" ng-model="Des" ng-change="change()"></th>
<th><input types="number" ng-model="Org" ng-change="change()"></th>
<th><input types="number" ng-model="Site" ng-change="change()"></th>
My filter argument is
$scope.change = function(){
$http.get("http://localhost:3000/pupdb/pupdb/?count&pagesize=10&filter={'uniprot_AC':{'$regex':'(?i)"+$scope.UniP+".*'},'gene_name':{'$regex':'(?i)"+$scope.GeneN+".*'},'species':{'$regex':'(?i)"+$scope.Org+".*'},'description':{'$regex':'(?i)"+$scope.Des+".*'},'site':{'$regex':'(?i)"+$scope.Site+".*'}}")
It turns out that I have to input a text or a blank space in all 5 input area before I can activate the filter and return a result. After that, I can input just in one area and left the other 4 blank, and the results showed. It seems like one input is not enough to trigger the filter.
I try to use ng-init and use one blank space and without one blank space, but it is not working at all. Only if there is one character in ng-init, it will trigger the filter.
I was thinking if an "or" argument in restheart filter will solve the problem? If so, please let me know how to write.
What should I do to over come this issue?