Hi,

I am trying to load a page which has a ng-table in a page with jquery
my function to load the subpage in the main page is like this:

 function loadSubPage(id){
        var random = Math.random()*1000000;           

            $("#aanvullingGegevens").load("gui/aanvragen/gekende_patient.php?patientID="+id+"&random="+random);

    }

and this is my sub-page

 <script type="text/javascript" src="scripts/angular/angular.js" ></script>
 <script type="text/javascript" src="scripts/angular/ng-table.js" ></script>

<div>   
        <script>
            var random = Math.random() * 10000;
            var aanvragenApp = angular.module('aanvragenApp', ['ngTable']);
            aanvragenApp.controller('aanvragenCtrl', function ($scope, $http ,$filter,  ngTableParams){


            $http.get("dal/selectAanvragenPatient.php?rnd="+random).success(function(data) {

                $scope.tableParams = new ngTableParams({
                   page: 1,            // show first page
                   count: 10,           // count per page

                }, {
                       total: data.length, // length of data

                       getData: function($defer, params) {

                       var filteredData = params.filter() ?
                       $filter('filter')(data, params.filter()) : data;

                       var orderedData = params.sorting() ?
                       $filter('orderBy')(filteredData, params.orderBy()) : data;

                       $scope.users = orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count());
                       params.total(orderedData.length); // set total for recalc pagination
                       $defer.resolve($scope.users);
                   }
               });              
               $scope.showDetails=function(test){
                        newwindow=window.open('editpatient.php?id='+test,'_blank','width=400, hight= 400');
                    if(window.focus)
                        newwindow.focus();

               }
           });

         })


        </script>

    <div ng-controller="aanvragenCtrl">

        </script>
        <table ng-table="tableParams" show-filter="true" class="table table-striped">
            <tr ng-repeat="x in $data">
                <td data-title="'AanvraagID'" sortable="'aanvraagid'" filter="{ 'aanvraagid' : 'text' }" ng-click="showDetails(x.aanvraagid)" >{{x.aanvraagid}}</td>  
                <td data-title="'Aanvraagdatum'" sortable="'aanvraagdatum'" filter="{'aanvraagdatum': 'text'}" ng-click="showDetails(x.aanvraagid)">{{x.aanvraagdatum}}</td>
                <td data-title="'Resultaat'" sortable="'resultaat'" filter="{'resultaat': 'text'}" ng-click="showDetails(x.aanvraagid)">{{x.resultaat}}</td>
                <td data-title="'Invuller'" sortable="'naamInvuller'" filter="{'naamInvuller': 'text'}" ng-click="showDetails(x.aanvraagid)">{{x.naamInvuller}}</td>
            </tr>      
        </table>   
    </div>

</div>

the ng-app="aanvragenApp" is located in the html tag on my main page.

When I try to load my subpage it doesn't show my data.
I am new to angular, can someone give some hints to help finding my mistake?

for some reason I have to start it manually with angular.bootstrap(document,['aanvragenApp']);
I think if I know who to start it automicly it will work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.