3

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?

8
  • check the network tab on your web browser and see whether the library is loaded Commented Apr 8, 2017 at 8:31
  • I have asked a similar question a while ago. Check it out, it may help you: stackoverflow.com/questions/42163088/… Commented Apr 8, 2017 at 8:39
  • Thanks @d_z90! Did you had any cannot find namespace THREE. error? Is there anything I'm missing? Commented Apr 8, 2017 at 9:07
  • Yes, I did but I remember that after updating the all packages the problem disappeared. Commented Apr 10, 2017 at 11:20
  • @TheUnreal, did you find a solution, can't figure out what is going on for hours... :( Commented Jun 10, 2017 at 0:59

2 Answers 2

2

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!

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.