如何在ng-template(Angularjs)中使用html表标签?

时间:2018-03-22 20:37:47

标签: angularjs html5 angular-ui-bootstrap ng-template

我使用ui.bootstrap.modal尝试了以下操作。 这是我用于bootstrap.modal的代码: 在HTML文件中:

  <script type="text/ng-template" id="myModalContent.html">
            <div class="modal-header">
                <h3 class="modal-title" id="modal-title">Program Account Checklist!</h3>
            </div>
            <div class="modal-body" id="modal-body">
                        <table>
                            <colgroup span="2"></colgroup>
                            <thead>
                                <tr>
                                <th colspan="2" scope="colgroup">Is your organization:</th>
                                <th>CRA Program Account</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td> checkbot </td>
                                    <td> info </td>
                                    <td> account </td>
                                </tr>
                            </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" type="button" ng-click="">Cancel</button>
                <button class="btn btn-primary" type="button" ng-click="">Clear</button>
                <button class="btn btn-primary" type="button" ng-click="">Submit</button>
            </div>
        </script>

在我的controller.js中:

 $scope.open = function() {
      var modalInstance = $uibModal.open({
        animation: true,
        ariaLabelledBy: 'modal-title',
        ariaDescribedBy: 'modal-body',
        templateUrl: 'myModalContent.html',
        resolve: {
            items: function () {
              return $scope.checklist;
            }
          },
        size: 'lg'
    })

现在的问题是,当我试图弹出一个带有表格的窗口时,数据显示在正确的位置,但是该表格没有任何ui。一切似乎都在纯文本中。我想这与type =&#34; text / ng-template&#34;有关。但我无法找到解决问题的方法。我该如何解决这个问题?   Here is my Image

1 个答案:

答案 0 :(得分:1)

如果我正确理解你的问题,你在桌子上缺少引导样式吗?在这种情况下,添加一些类名:

<table class="table table-borderless">

</table>