Using aframe with Angular 2

烂漫一生 提交于 2019-12-22 18:28:57

问题


I'm trying to use Aframe in my angular 2 project.

I imported the library in my index.html but I still can't use the aframe directive, for example:

<a-scene>
    <a-box color="red"></a-box>
  </a-scene>

Throws the error:

Template parse errors:
'a-box' is not a known element:
1. If 'a-box' is an Angular component, then verify that it is part of this module.

How I can import such library to my angular 2 project and use it's directives?


回答1:


I fixed doing this:

I Try adding:

import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';

to app.module.ts

then i add it to the NgModule Schemas:

@NgModule({ schemas: [ CUSTOM_ELEMENTS_SCHEMA ]})

that will fix it. Good luck!




回答2:


Try adding import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; to app.module.ts



来源:https://stackoverflow.com/questions/43291878/using-aframe-with-angular-2

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