google-chrome - Chrome 上的 Angular2 表格行组件以单列显示

标签 google-chrome internet-explorer angular angular2-components

正在使用的版本:

  • Angular 2.0.1
  • Angular -cli 1.0.0-beta.17

我有一个分为 3 个部分的页面。页面大纲,一个表格,它有自己的布局,包括行,这些行之一包含一个行组件。 在 IE 中,表格显示正常,在 Chrome 中,组件行中的所有数据都显示在第一列中。

main.html

<form>
     <div>Title Stuff etc.</div>
     <table-component [qlineModel]="QuoteLineModel"></table-component>
     <div>Other stuff</div>
</form>

表格.html

<table>
   <thead>
      <tr>
        <th>ColA</th>
        <th>ColB</th>
        <th>Option</th>
     </tr>
   </thead>
   <tbody>
      <row-component *ngFor="let qlines of qlineModel" 
                            [qline]="qlines">
      </row-component>
      <tr>
         <td>Tot A</td>
         <td>Tot B</td>
         <td>Tot Opt</td>
      </tr>
    </tbody>
  </table>

行.html

<tr>
   <td>{{qline.A}}</td>
   <td>{{qline.B}}</td>
   <td>{{qline.C}}</td>
</tr>

IE 给我预期的输出

       Title Stuff etc
   ColA |  ColB  | Col C
   100     200     300
   200     300     400
   ___________________
   300    500     700
       Other Stuff

但是,Chrome 给出了我不期望的输出

       Title Stuff etc
   ColA        |  ColB  | Col C
   100 200 300
   200 300 400
   _____       ______________
   300           500     700
       Other Stuff

我可以通过将表格数据放入一个组件中来解决这个问题,但是 a) 对我来说破坏了对象,并且 b) 我想潜在地打印表格,所以理想情况下希望保持原样。 我试过 Angular2 table rows as component但不断得到 NgFor 只支持数组等 Iterables

感谢收到的任何帮助。

最佳答案

你不能有 <row-component><tbody> 里面因为那不是 <tbody> 的有效 child .

您可以更改 RowComponent 的选择器至 [rowComponent]然后像这样使用它

<tr rowComponent *ngFor="let qlines of qlineModel" 
                        [qline]="qlines">

关于google-chrome - Chrome 上的 Angular2 表格行组件以单列显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39964173/

相关文章:

javascript - 多个单独的浏览器,每个浏览器一个选项卡 - 同时与页面上的元素交互( headless puppeteer )

php - IE 中 HTTPS Ajax 请求的问题(非跨域)

css - 什么是行为 : url(); property in css?

Angular/Reactive Forms - 添加或删除 FormControl 列表 - 绑定(bind)模板(带演示)

angular - Okta 登录小部件破坏了 Jest 测试 - TypeError : Cannot read property 'backingStorePixelRatio' of null

javascript - 如何通过 Angular 检查空格键事件?

javascript - 从 Chrome 扩展获取数据

javascript - 在 Chrome 网络蓝牙 API 中未经用户许可连接到配对设备?

css - 在 Chrome 中工作的 SVG 上的 CSS 动画的 transform-origin,而不是 FF

html - CSS 菜单下拉菜单在 IE8 中不起作用