2015-12-23 56 views
0

您好我是新來角JS的問題是我得到表中的所有數據在mysqldatabase表單中的json數組形式,但我想顯示錶中的數據在莫代爾以及對於細節:如何在angularJS中獲取ng對話框中的數據

這裏是我的html我包括在頁面底部命名_detail_modal.html

<table ng-table="table.tableParams5" class="table table-bordered table-striped table_feature"> 
 
    <tbody> 
 
    <tr> 
 
     <th>S.No</th> 
 
     <th>Name</th> 
 
     <th>Order</th> 
 
     <th>Status</th> 
 
     <th>SEO</th> 
 
     <th>Action</th> 
 
    </tr> 
 
    <tr ng-repeat="user in $data | filter:searchText"> 
 
     <td data-title="'pkCategoryId'" >{{$index + 1}}</td> 
 
     <td data-title="'Name'" >{{user.Name}}</td> 
 
     <!-- <td data-title="'Order'">{{user.Order}}</td> --> 
 
     <td> 
 
     <select class="form-control input-sm" ng-model="rec.orders" name="Order"> 
 
      <option ng-repeat="orders in order" ng-selected="{{orders.Order == user.Order}}" value="{{orders.order}}">{{orders.Order}}</option> 
 
     </select> 
 
     </td> 
 
     <td data-title="'Status'">{{user.Status}}</td> 
 
     <td><button class="btn btn-sm btn-info" title="SEO" ng-click="seo()"> 
 
     <em class="fa fa-search"></em> 
 
     </button> 
 
     </td> 
 
     <td> 
 
     <button class="btn btn-sm btn-info" title="View Category" ng-click="details()" > 
 
     <em class="fa fa-list"></em> 
 
     </button> 
 
     <!--modal start --> 
 
     <!-- Modal end --> 
 
     <button class="btn btn-sm btn-info" title="Edit Category" ui-sref="app.editmanage_category({id:user.pkCategoryId})" > 
 
     <em class="fa fa-pencil"></em> 
 
     </button> 
 
     <button class="btn btn-sm btn-danger" title="Delete Category" ng-click="delete(user.pkCategoryId);"> 
 
     <em class="fa fa-trash"></em> 
 
     </button> 
 
     </td> 
 
    </tr> 
 
    </tbody> 
 
</table> 
 
</div> 
 
</div> 
 
<div ng-include="'app/views/_confirm_modal.html'"></div> 
 
<div ng-include="'app/views/manage_category/_details_modal.html'"></div> 
 
<div ng-include="'app/views/manage_category/_seo_modal.html'"></div>

這裏的文件_detail_modal.html

<script type="text/ng-template" id="modalDetailsDialogId"> 
 
    <div class="ngdialog-message"><h3> Manage Category Details</h3> 
 
    <p> Name:{{user.Name}} </p> 
 
    
 
    <button type="button" ng-click="closeThisDialog('button')" class="btn btn-default">Cancel</button> 
 
    </div> 
 
</script>

終於在這裏是我的JS

$scope.details = function() { 
 
    ngDialog.open({ 
 
    template: 'modalDetailsDialogId', 
 
    scope: $scope, 
 
    className: 'ngdialog-theme-default' 
 
    }); 
 
};

任何幫助,將不勝感激感謝。

+0

更好使用範圍:$ scope.user –

回答

0

$scope.details = function() { 
 
    ngDialog.open({ 
 
    template: 'app/views/_confirm_modal.html', 
 
    scope: $scope, 
 
    className: 'ngdialog-theme-default' 
 
    }); 
 
};
可以包括通過{{user.Name}}

0

呼叫ngdialog.open如下通過控制器模板,然後訪問數據 - 非常重要的是傳遞數據的選項。 (數據:DATAO)

從一個控制器:

$scope.EditShow = function(dataO) { 

     ngDialog.open({ 
      template: 'showDialog', 
      controller: 'TopController', 
      className: 'ngdialog-theme-default', 
      disableAnimation: true, 
      scope: $scope, 
      data: dataO 
     }); 

    } 
在另一個控制器

($ scope.ngDialogData給出了已經在Editshow(DATAO作爲數據傳遞的所有選定的值)

App.controller('TopController', function ($scope, $http) { 
    $scope.Detail = $scope.ngDialogData.Description 
}); 
相關問題