Angularjs filter two values


#1

I’m having a problem if it is not easy to solve ta. In my database I have a table in organizations and some of them may be “hidden”. You may not see them on a list unless enter a unique code given by the administrator. If the user types the code only then that organization may appear in the list.

My list now looks like this:

<a class="item item-avatar" ng-repeat="lugar in organizations_all | filter:search" ng-click="mostrarAreas(lugar.id)" ng-if="organizations_filter !=''" ng-show="!lugar.hide">
  <img image-lazy-src="{{lugar.photo}}" style="border-radius: 0 !important;">
 <button class="button button-icon icon ion-plus-circled" ng-click="agregarLugar(lugar.id,lugar.private);$event.stopPropagation()" style="float: right;"></button>
 <h2>{{lugar.name}}</h2>
 <p class="icon ion-ios-locked" style="font-size:20px;"  ng-show="lugar.private"></p>
</a>

Json:

{ "Count" : 5,
"Organization" : [ { "code" : "",
"hide" : false,
"id" : "1",
"name" : "Odebret Advisors Ltda.",
"private" : false
},
{ "code" : "",
"hide" : false,
"id" : "2",
"name" : "MOP Ruta 5 Sur (SCL - Talca)",
"private" : false
},
{ "code" : "",
"hide" : false,
"id" : "3",
"name" : "MOP Ruta 5 Norte (SCL - Los Vilos)",
"private" : false
},
{ "code" : "",
"hide" : false,
"id" : "4",
"name" : "Lixsys SpA",
"private" : true
},
{ "code" : "lxspa",
"hide" : true,
"id" : "5",
"name" : "Prueba Oculta",
"private" : false
}
],
"status" : 1
}

As you can see, there is a “hide” field if true, must hide that organization and also a “code” field is the only code to find and must be entered FULL whereas if we filter by name, you can discriminate by 1 point on.