在Angular 2中使用框架 [英] Using aframe with Angular 2

查看:75
本文介绍了在Angular 2中使用框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的angular 2项目中使用Aframe。

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

我将库导入了index.html,但仍然无法使用aframe指令,例如:

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>

抛出错误:

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.

如何将此类库导入我的angular 2项目并使用它的指令?

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

推荐答案

我已固定执行此操作:

我尝试添加:

从 @ angular / core导入{CUSTOM_ELEMENTS_SCHEMA};

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

到app.module.ts

to app.module.ts

然后将其添加到NgModule模式中:

then i add it to the NgModule Schemas:

@NgModule({
模式:[
CUSTOM_ELEMENTS_SCHEMA
]})

@NgModule({ schemas: [ CUSTOM_ELEMENTS_SCHEMA ]})

修理它。祝你好运!

这篇关于在Angular 2中使用框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆