嗨,我是 Angular JS 的新手,问题是我正在通过 mysqldatabase 以 json 数组的形式获取表列表中的所有数据,但我也想在 Modal 中显示该表数据以获取详细信息:
这是我的 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'
});
};
任何帮助将不胜感激。