javascript - relational database data using ngrepeat -


enter image description herei want show data in parent-child(bu_name) format using angularjs, used ng-repeat it's not working in paren-child manner, please give hint or explanation how solve problem?

     var businessdata = [{         "bu_id": 2,         "tenant_id": 1,         "company_id": 1,         "bu_name": "qhhjqqw",         "created_date": "2016-05-31 10:58:06",         "updated_date": "2016-05-31 10:58:06",         "parent_id": null     }, {         "bu_id": 3,         "tenant_id": 1,         "company_id": 1,         "bu_name": "kqjjk",         "created_date": "2016-05-31 10:58:12",         "updated_date": "2016-05-31 10:58:12",         "parent_id": 2     }, {         "bu_id": 5,         "tenant_id": 1,         "company_id": 1,         "bu_name": "parent",         "created_date": "2016-06-28 08:32:34",         "updated_date": "2016-06-28 08:32:34",         "parent_id": null     }, {         "bu_id": 6,         "tenant_id": 1,         "company_id": 1,         "bu_name": "child",         "created_date": "2016-06-28 08:32:48",         "updated_date": "2016-06-28 08:32:48",         "parent_id": 5     }, {         "bu_id": 7,         "tenant_id": 1,         "company_id": 1,         "bu_name": "child_s child",         "created_date": "2016-06-28 08:33:16",         "updated_date": "2016-06-28 08:33:16",         "parent_id": 6     }]; 

i have working example

<!doctype html> <html ng-app="myapp"> <head>     <meta charset="utf-8">     <title>angular application</title>     <script src="lib/angular/angular.min.js" type="text/javascript" ></script> </head> <body>  <div  ng-controller="mycontroller"> <div class="container"> <br/> <div class="row well">     <div class="col-md-3">         <h3>search</h3>     </div>     <div class="col-md-6">             <input type="text" class="form-control" ng-model="search" placeholder="enter search word"/>     </div>  </div> <table id="example" class="table table-striped table-bordered" width="100%" cellspacing="0">         <thead>             <tr>                 <th>bu_id</th>                 <th>tenant_id</th>                 <th>company_id</th>                 <th>bu_name</th>                 <th>date</th>              </tr>         </thead>          <tbody>             <tr ng-repeat="item in jsondata | filter:search">                 <td>#{{item.bu_id}}</td>                 <td>{{item.tenant_id}}</td>                 <td>{{item.company_id}}</td>                 <td>{{item.bu_name}}</td>                 <td>{{item.created_date}}</td>             </tr>                 </tbody>           </table>  </div> </div> <script> var app = angular.module("myapp", []);  app.controller("mycontroller", ['$scope','$http', function($scope, $http)         {                      $scope.jsondata =[{         "bu_id": 2,         "tenant_id": 1,         "company_id": 1,         "bu_name": "qhhjqqw",         "created_date": "2016-05-31 10:58:06",         "updated_date": "2016-05-31 10:58:06",         "parent_id": null     }, {         "bu_id": 3,         "tenant_id": 1,         "company_id": 1,         "bu_name": "kqjjk",         "created_date": "2016-05-31 10:58:12",         "updated_date": "2016-05-31 10:58:12",         "parent_id": 2     }, {         "bu_id": 5,         "tenant_id": 1,         "company_id": 1,         "bu_name": "parent",         "created_date": "2016-06-28 08:32:34",         "updated_date": "2016-06-28 08:32:34",         "parent_id": null     }, {         "bu_id": 6,         "tenant_id": 1,         "company_id": 1,         "bu_name": "child",         "created_date": "2016-06-28 08:32:48",         "updated_date": "2016-06-28 08:32:48",         "parent_id": 5     }, {         "bu_id": 7,         "tenant_id": 1,         "company_id": 1,         "bu_name": "child_s child",         "created_date": "2016-06-28 08:33:16",         "updated_date": "2016-06-28 08:33:16",         "parent_id": 5     }];           }] ); </script> </body> </html> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -