无法分配给对象“#”的只读 属性 'detachedCallback'

Cannot assign to read only property 'detachedCallback' of object '#'

我通过

安装了A-Frame
npm install aframe --save.

当我使用时:

import 'aframe';  // or use: require 'aframe';
import { Component } from '@angular/core';

@Component({
  selector: 'app',
  template: `
    <a-scene></a-scene>
  `
})
export class AppComponent {}

我收到错误:

zone.js:1046Uncaught TypeError: Cannot assign to read only property 'detachedCallback' of object '#'

我检查了这个Angular_VRDemo,但我自己还是没搞清楚。

我猜是因为 aframe 库没有通过创建自定义元素来实现某些属性(如 detachedCallback 和其他)。 https://github.com/aframevr/aframe/blob/v0.3.1/src/core/a-assets.js#L13-L73

zonejs 已覆盖需要所有属性的 document.registerElement 版本,因此它会中断库加载 (https://github.com/angular/zone.js/blob/v0.6.17/dist/zone.js#L1151-L1170)。

作为解决方法,您可以在 zonejs 之前加载此库