Forms in Angular 2 RC4

后端 未结 1 512
孤城傲影
孤城傲影 2021-02-19 18:29

I am experimenting with forms in Angular 2 RC4. It\'s all working fine but when I start the app the browser console gives me this message:

*It looks like you\'re         


        
1条回答
  •  暖寄归人
    2021-02-19 19:18

    You need to explicitly disable the deprecated form support when bootstrapping your application:

    import {disableDeprecatedForms, provideForms} from '@angular/forms';
    
    bootstrap(AppComponent, [
      disableDeprecatedForms()
      provideForms()
    ]);
    

    Whereas FormBuilder isn't deprecated, you can use directly the FormGroup class instead:

    this.filterForm = new FormGroup({
      title: new FormControl('', Validators.required)
    });
    

    0 讨论(0)
提交回复
热议问题