-
1 votesanswersviews
在Angular 4中导入多个模块中的组件
我有 SharedModule import { NgModule } from '@angular/core'; import { ControlMessagesComponent } from './control-messages.component'; @NgModule({ imports: [ ], declarations: [ ControlMessagesC... -
0 votesanswersviews
“错误:Root应该是UIViewController或UIView”Nativescript
所以我正在尝试在新模块中创建一个组件,然后在'app'中使用它,但是我收到了这个错误: Error: Root should be either UIViewController or UIView 这是我的sample.module.ts: import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; import { NativeSc... -
0 votesanswersviews
Angular 4错误:“无法通过延迟加载解析来自app模块的exrternal模块”
外部Angular应用程序/模块: @NgModule({ declarations: [ HelloComponent ], imports: [ CommonModule, UpgradeRoutingModule ], exports: [], providers: [], bootstrap: [] }) export class UpgradeModule { }... -
61 votesanswersviews
Angular 2 'component'不是已知元素
我正在尝试在其他模块中使用我在AppModule中创建的组件 . 我收到以下错误: “未捕获(承诺):错误:模板解析错误:'contacts-box'不是已知元素:如果'contacts-box'是Angular组件,则验证它是否是此模块的一部分 . 如果'contacts- box'是一个Web组件,然后将'CUSTOM_ELEMENTS_SCHEMA'添加到此组件的'@ NgModule.s... -
0 votesanswersviews
Angular:从延迟功能模块添加多提供程序
我有一个ErrorModule(eager)配置如下: export const CONFIG = new InjectionToken<ErrorConfig[]>('Module errors configuration.'); @NgModule({ imports: [... ] }) export class ErrorModule { static forRoo... -
30 votesanswersviews
进口/出口在Angular 2 ngModule中的作用
我正在学习Angular 2,我很难理解ngModule中导入/导出的作用 . 更具体地说,为什么导入模块很重要,如果你要使用es6语法导入它也是如此 import { BrowserModule } from '@angular/platform-browser'; @NgModule({ imports: [ BrowserModule ], providers: [ ... -
3 votesanswersviews
Angular - 跨多个模块使用组件
What I'm using Angular What I'm trying to do 我有一个我想在多个模块中重用的加载组件 What I've done 我创建了一个名为'loading-overlay'的新模块 在此模块中,我导出叠加组件 我将此模块添加到app.module 将组件添加到多个模块时,我收到以下错误: 类型LoadingOverlayCompo... -
0 votesanswersviews
Angular Lazy Loaded Modules错误 - 'RouterModule.forRoot() called twice'
我正在我的angular 6应用程序中实现延迟加载的功能模块,并已成功配置一个“发票”功能,但我在为延迟加载的“费用”和“联系人”功能模块实施路由时遇到问题,它们的设置方式与第一种方式相同 . 每个模块都已导入AppModule,它们也使用SharedModule,我已将其导入AppModule和每个功能模块 . 使用“费用”或“联系人”模块路由到任何页面时,我在控制台中收到以下错误: 错误错误... -
1 votesanswersviews
从延迟加载的模块中的要素组件中分离页面组件
在一个大的单模块Angular 5应用程序上工作我试图将它分成多个模块,以提高可维护性和性能(延迟加载) . 我做了什么 我已经创建了多个专门用于延迟加载的模块 . 他们包含 navigating to the route 时应呈现的主要组件(页面) 子路径的所有组件(页面) 上述组件中使用的所有要素组件(不可路由) . 看来我需要使用多个模块中的一些功能组件,我正在考虑 继续... -
0 votesanswersviews
包括来自单独的Angular应用程序的组件
让我们假设相邻文件夹中有两个Angular 4应用程序具有这样的结构: App1 package.json src app.module.ts App2 package.json src welcome.component.ts 我想要做的是从第一个应用程序的模块中导入欢迎组件 . 问题是,当我这样做时,它编译并运行没有任何问题,但在我打开页面后,我得到一个错误... -
0 votesanswersviews
Angular AoT编译和同步注入?
是否可以使以下代码与AoT兼容? interface Config { someField?: string; anotherField?: number; } @NgModule({}) export class SomeModule { protected static _config: Config; public static withConfig(co...