我正在试验角度2 RC4中的形式.
这一切都很好,但是当我启动应用程序浏览器控制台给我这个消息:
这一切都很好,但是当我启动应用程序浏览器控制台给我这个消息:
*It looks like you're using the old forms module. This will be opt-in in the next RC,and will eventually be removed in favor of the new forms module.
我的组件的相关部分如下所示:
import { FORM_DIRECTIVES,REACTIVE_FORM_DIRECTIVES,FormBuilder,FormGroup } from '@angular/forms'; import {Observable} from "rxjs/Rx"; @Component ({ selector: "hh-topbar",moduleId: module.id,templateUrl: "topBar.component.html",directives: [HHPagerComponent,FORM_DIRECTIVES,REACTIVE_FORM_DIRECTIVES] }) export class HHTopBarComponent implements OnChanges,OnInit { ... private filterForm: FormGroup; private title$: Observable<string>; constructor(private formBuilder: FormBuilder) { } public ngOnInit(): any { this.filterForm = this.formBuilder.group ({ "title": [this.info.filters.searchFileName] }); this.title$= this.filterForm.controls["title"].valueChanges; this.title$.subscribe(val => { this.info.filters.searchFileName = val; this.filterChanged.emit(this.info.filters); }); } }
我的模板的相关部分如下所示:
<form [formGroup]="filterForm"> <div> <label for="title">Title</label> <input [formControl]="filterForm.controls['title']" id="title" /> </div> </form>
有谁在这里知道警告所说的新形式模块是什么,哪些指令会改变什么?