我在全局上安装了@角/Cli@11.0.0。我创建了一个角度项目,使用命令行"ng新BabylonTest --路由错误样式的css --跳过-git--跳过-测试“。CD到文件夹'BabylonTest',然后通过键入'npm @babylonjs/viewer‘安装@babylonjs/viewer,安装@babylonjs/view4.2.0。在类型记录文件'app.component.ts‘中,我从' @babylonjs/viewer’中添加了'import * as BabylonViewer‘一行,从而导入了@babylonjs/viewer。在模板文件'app.component.html‘中,我删除了所有内容,只添加了一个html元素如下所示,然后当我通过输入'ng serve’编译它时,它返回了以下错误:
错误: src/app/app.component.html:4:1 -错误NG8001:‘巴比伦’不是已知的元素:
。
4.
src/app/app.component.ts:8:16
8 templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppComponent.
I am not sure what was wrong with my codes, was I missing something? I was using this link:
https://www.npmjs.com/package/@babylonjs/viewer to get the usage of @babylonjs/viewer. 发布于 2021-05-24 18:03:00
在巴比伦查看器项目导出WebComponent而不是角组件时,您需要将自定义元素模式添加到@NgModule定义中,如下所示:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@NgModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA], // <= this line
imports: [BrowserModule, FormsModule],
providers: [],
bootstrap: [AppComponent]
})https://stackoverflow.com/questions/67676685
复制相似问题