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

醉酒当歌 提交于 2019-12-08 01:54:58

问题


I installed A-Frame by

npm install aframe --save.

When I use:

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

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

I got the error:

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

I checked this Angular_VRDemo, but still did not figure out myself.


回答1:


I guess it because aframe library doesn't implement some properties (like detachedCallback and other) by creation custom element. https://github.com/aframevr/aframe/blob/v0.3.1/src/core/a-assets.js#L13-L73

zonejs has overrided version of document.registerElement that requires all properties so it breaks library loading (https://github.com/angular/zone.js/blob/v0.6.17/dist/zone.js#L1151-L1170).

As workaround you can load this library before zonejs



来源:https://stackoverflow.com/questions/39929901/cannot-assign-to-read-only-property-detachedcallback-of-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!