Javascript 角形6个部件。Angular应用程序中的Angular元素不工作
我在angular应用程序中运行angular元素时遇到问题。 我有简单的应用程序和简单的组件。应用模块:Javascript 角形6个部件。Angular应用程序中的Angular元素不工作,javascript,angular,angular6,Javascript,Angular,Angular6,我在angular应用程序中运行angular元素时遇到问题。 我有简单的应用程序和简单的组件。应用模块: 从'@angular/platform browser'导入{BrowserModule}; 从'@angular/core'导入{ChangeDetectorRef,自定义元素\模式,注入器,NgModule}; 从“./app.component”导入{AppComponent}; 从“./test/test.component”导入{TestComponent}; 从“@angul
从'@angular/platform browser'导入{BrowserModule};
从'@angular/core'导入{ChangeDetectorRef,自定义元素\模式,注入器,NgModule};
从“./app.component”导入{AppComponent};
从“./test/test.component”导入{TestComponent};
从“@angular/platform browser/animations”导入{BrowserAnimationsModule}”;
从“@angular/forms”导入{FormsModule};
从“Priming/Priming”导入{ButtonModule、DropdownModule、InputExtModule};
从“./test2/test2.component”导入{Test2Component};
从“@angular/elements”导入{createCustomElement}”;
@NGD模块({
声明:[
应用组件,
测试组件,
Test2组件
],
进口:[
浏览器模块,
BrowserAnimationsModule,
FormsModule,
下拉模块,
输入文本模块,
按钮模块,
],
提供者:[],
entryComponents:[TestComponent],
引导:[AppComponent],
模式:[自定义元素\u模式]
})
导出类AppModule{
构造函数(专用注入器:注入器){
const TestElement=createCustomElement(TestComponent,{injector});
自定义元素。定义('appd-test',TestElement);
}
ngDoBootstrap(){
}
}
为什么不能将功能模块导入主模块并将其包含在模板中?这样做有什么挑战吗?是的,我知道我可以以角度的方式导入模块(导入模块),但我想独立于技术。将来我还想导入ReactJS、VueJS等,所以我不能只导入模块,我必须以webcomponents的方式只导入javascript(如上所述)。您好,您解决了您的问题吗?我认为这违背了自以为是的框架的本质。我很感激你想要自由选择哪种框架,但你正在为自己设置一个维护噩梦。Angular将需要每两年升级一次以维持支持。。。我会避免这个想法。