无法分配为对象“#”的只读属性“ detachedCallback” [英] Cannot assign to read only property 'detachedCallback' of object '#'
问题描述
我安装了 A框架,由
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:1046未捕获的TypeError:无法分配为仅读取对象'#'的属性
'detachedCallback'
zone.js:1046Uncaught TypeError: Cannot assign to read only property 'detachedCallback' of object '#'
我检查了此 Angular_VRDemo ,但仍然不了解我自己。
I checked this Angular_VRDemo, but still did not figure out myself.
推荐答案
我猜是因为 aframe
库没有通过创建自定义元素来实现某些属性(例如 detachedCallback
等)。
https:/ /github.com/aframevr/aframe/blob/v0.3.1/src/core/a-assets.js#L13-L73
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已被覆盖需要所有属性的 document.registerElement
版本,因此会中断库加载( https://github.com/angular/zone.js/blob/v0.6.17/dist/zone.js#L1151-L1170 )。
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).
作为解决方法,您可以在zonejs之前加载此库
As workaround you can load this library before zonejs
这篇关于无法分配为对象“#”的只读属性“ detachedCallback”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!