0

将 td.height 属性绑定到数字会在 IE11 中生成堆栈跟踪,但在 Firefox 和 Chrome 中有效。

<td [height]="bufferHeight"></td>

bufferHeight 变量初始化为 30

  bufferHeight: number;

  constructor() {
    this.bufferHeight = 30;
  }

纠正此问题的一种方法是将缓冲区高度设为字符串并将其初始化为“30px”。

当我意识到 HTML5 中不推荐使用 height 属性并切换到以下内容时,我最终修复了代码

<td [style.height.px]="bufferHeight">

为什么 IE 的行为不同?由于神秘的错误消息,此类错误可能难以追踪。这个项目是用角种子引导的。

Error: Uncaught (in promise): Error: Error in http://localhost:5555/app/test/test.component.html:17:44 caused by: Invalid argument.
   at resolvePromise (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:429:25)
   at resolvePromise (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:414:17)
   at Anonymous function (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:462:17)
   at ZoneDelegate.prototype.invokeTask (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:234:17)
   at onInvokeTask (eval code:5967:25)
   at ZoneDelegate.prototype.invokeTask (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:234:17)
   at Zone.prototype.runTask (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:136:21)
   at drainMicroTaskQueue (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:368:25)
   at invoke (http://localhost:5555/node_modules/zone.js/dist/zone.js?1482518301781:308:25)
4

0 回答 0