Displaying a table using DataTables and AngularJS I am using DataTables to format and display a table. I started the project using AngularJS with a PHP backend but I needed to inject some Vanilla JS and JQuery code in order to use DataTables.

Is this approach/organization fine, or should I be trying to use AngularJS modules like ngTable to keep the project "pure".

AngularJS + JQuery snippet for pulling data in DataTable


$http.post('requests.php', data, config).then(
function(response) {
        var df = response.data['data'];

        // Put data into table
        $("#UserTable").DataTable( {
            pagingType: "full_numbers",
            processing : true,
            data: df,
            order: [[ 0, "desc" ]],
            columns:
       [
          { data: "user" },
          { data: "name" }
       ]
    } );
});



PHP BACKEND

if (isset($params['req']) &amp;&amp; $params['req'] == "users") {

  $json = array();
  foreach ($cma_DB-&gt;query($sql) as $row) {

  //  MAKE ARRAY ASSOCIATIVE; THIS WAS BROKEN IN OTHER VERSIONS OF DATATABLES

    $json[] = array(
      'user'  =&gt; $row['user'],
      'name'  =&gt; $row['first_name'] . " " . $row['last_name']
    );
  }
    // MAKE RESPONSE HAVE 'data' ENTRY //
    $response = array();
    $response['success'] = true;
    $response['data'] = $json;

    echo json_encode($response);
}



VERSUS

Something written using ngTable
I think your question is architectural in its nature, and it's rather hard to tell whether you want to prerender as much as you can on server side (meaning via PHP) or do most of the work on the client (i.e. via Angular.js). Each approach has its pros and cons.

Here are a few sources that may help you form your opinion about whether to go


client-heavy (would be my default pick)
server-heavy
spread complexity across layers (I'm really not a fan of having bits and pieces of scattered business logic).


To get a more definitive answer about which way to go, you would really need to provide the list of both functional and non-functional requirements to your system.