1.Can't bind to 'formGroup' since it isn't a known property of 'form'
解决方法:
需要在你的模块中从@angular/forms
中导入ReactiveFormsModule
。例如:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
2.Element implicitly has an ‘any’ type because type ‘{}’ has no index signature
解决方法:
把定义的变量归属于any类型即可
public articelDetails:any = {};