每当我尝试使用formbuilder时,它都会崩溃。
无法解析FormtestComponent的所有参数
当我删除
时constructor(private _fb: FormBuilder) { }
我没有收到此错误。
你知道问题是什么吗?
import { Component, OnInit } from '@angular/core';
import { REACTIVE_FORM_DIRECTIVES, FormGroup,
FormBuilder, Validators } from '@angular/forms';
@Component({
selector: 'formtest',
templateUrl: './app/formtest/formtest.component.html',
styleUrls: ['./app/formtest/formtest.component.css'],
directives: [REACTIVE_FORM_DIRECTIVES]
})
export class FormtestComponent {
myForm: FormGroup;
constructor(private _fb: FormBuilder) { }
}
Bootstrapper.ts
import { Main } from "./main";
import { bootstrap } from "@angular/platform-browser-dynamic";
import { disableDeprecatedForms, provideForms } from "@angular/forms";
bootstrap(Main, [
disableDeprecatedForms(),
provideForms()
]);