I have a table which I want to re-sort by picking a tab or menu item. 

Context:
The table is populated with all "orders" in the SQL DB, and by clicking a tab for a specific area it should update the table with orders only in that area.

Can I make an IF statement somehow, or a while-loop in angular? 

Currently it gets its data like this in php (where I already try to filter);

```
<?php

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
echo json_encode($data);

// creates a connection to the mysql server
require('connection.php');

$filterGeo = $filterSta = $filterNH = $filterNot = '%';

if (isset($_GET['filterGeo'])) {$filterGeo = $_GET['filterGeo'];};
if (isset($_GET['filterSta'])) {$filterSta = $_GET['filterSta'];};
if (isset($_GET['filterNH'])) {$filterNH = $_GET['filterNH'];};
if (isset($_GET['filterNot'])) {$filterNot = $_GET['filterNot'];};

$result = $conn->query("SELECT * FROM orders
    Where address LIKE '%$filterGeo%' AND status LIKE '%$filterSta%'");

$outp = "";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
    if ($outp != "") {$outp .= ",";}
    $outp .= '{"orderID":"'  . $rs["orderID"] . '",';
    $outp .= '"customerID":"'  . $rs["customerID"] . '",';
    $outp .= '"date":"'   . $rs["date"] . '",';
    $outp .= '"address":"'. $rs["address"]  . '",';
    $outp .= '"area":"'. $rs["area"]     . '"}';
}

$outp ='{"orders":['.$outp.']}';
$outp = utf8_encode($outp);

$conn->close();
echo($outp);

//?>

```

And the JSON is handled by angular like this;

```
var app = angular.module('Orders', []);   app.controller('getOrders', function($scope, $http) {
     $http.get("/filterOrders.php")
     .then(function (response) {$scope.orders = response.data.orders;});   });

```

The relevant HTML snippet:

```
  <div ng-app="Orders" ng-controller="getOrders">

            <ul class="nav nav-tabs">
              <li role="presentation" class="active"><a href="#">Alle</a></li>
              <li role="presentation"><a href="#">Odder</a></li>
              <li role="presentation"><a href="#">Hørning</a></li>
              <li role="presentation"><a href="#">Ry</a></li>
              <li role="presentation"><a href="#">Skanderborg</a></li>
            </ul>
          <table class="table table-condensed table-border table-striped">
            <thead align="center">
              <th>Order #</th>
              <th>Customer #</th>
              <th>Address</th>
              <th>Area</th>
              <th>Date</th>
              <th>OrderType</th>
              <th>TrashcanType</th>
              <th>Status</th>
              <th>RenoNord Invoice</th>
            </thead>
            <tbody>
              <tr ng-repeat="x in orders">
                <td>{{ x.orderID }}</td>
                <td>{{ x.customerID }}</td>
                <td>{{ x.address }}</td>
                <td>{{ x.area }}</td>
                <td>{{ x.date }}</td>
                <td>{{ x.orderType }}</td>
                <td>{{ x.trashcanType }}</td>
                <td>{{ x.status }}</td>
                <td>{{ x.renonord }}</td>

                <td class="text-right">
                  <button href="#" data-id="{{ x.orderID }}" class="btn btn-xs btn-default">Ret</button>
                  <button href="#" data-id="{{ x.orderID }}" class="btn btn-xs btn-danger">Slet</button>
                </td>

```