我用的是角度加载模块。每个组件都有自己的模块。如果我在根模块(app.module)中导入一个模块,它必须正常工作。例如,我在HttpClientModule中导入了app.module,并可以在子组件中使用它。
但是关于FormsModule,这并不是很好。我必须在子模块中导入它,否则,我会得到以下错误:
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("
你知道为什么会这样吗?
我试图在我的项目中添加一个常规类,但我得到了
zone.js:917 Uncaught Error: Unexpected value 'Tools' declared by the module 'AppModule'.
Please add a @Pipe/@Directive/@Component annotation.
它只是一个常规的类型记录类,我希望能够在我的项目中使用
它不是指令,也不是管道,也不是组件。
export class Tools
{
pascalCase(text:string)
{
return t
最新的Angular 2.0.0,通过最新的angular-cli 1.0.0-beta.14,node: 6.6.0,os: linux x64
我的工作是:
1)创建新项目
ng new angular-test
ng g component projects
ng g component typings
2)添加简单路由
/src/app/app.component.html
<router-outlet></router-outlet>
/src/app/app.module.ts
export const ROUTES: Routes = [
{
无法让Angular4使用延迟加载和动画。所以我在我的app-modules.ts中加载了BrowserAnimationsModule,并且动画在主模块中运行良好,但在延迟加载的模块中就不行了,所以我尝试在我的共享模块中加载BrowserAnimationsModule,因为我得到了一个错误:Unhandled Promise rejection: BrowserModule has already been loaded. If you need access to common directives
这是我的共享模块:
var sharedComponents = [Tabs, Tab
我的html模式组件中有以下代码: <ng-container *ngFor="let school of schools">
{{school.name}}
<ng-container> 然而,我得到了以下错误: “Can't bind to 'ngForOf' since it isn't a known property of 'ng-container' 我已经在网上查看了其他人的解决方案,他们建议导入表单模块、反应式表单模块和通用模块,但我已经将它们导入到了模态模块中 import { F
我有一个应用程序模块和一个功能模块。功能模块中声明了一个名为"AudioPlayerComponent“的组件。我想在应用模块中使用它,但它没有显示。没有错误。
我是不是遗漏了什么?
应用程序模块:
@NgModule({
imports: [
BrowserModule,
HomeModule,
ReciterModule, // the feature module which has the audio player
routing
],
declarations: [
AppComponent,
NavCompone