Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using aframe with Angular 2

Tags:

angular

aframe

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?

like image 560
TheUnreal Avatar asked Nov 26 '25 01:11

TheUnreal


1 Answers

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!

like image 54
Hyperios Avatar answered Nov 27 '25 14:11

Hyperios



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!