【问题标题】:Angular Js 2 - Can't bind to 'formControl' since it isn't a known property of 'input'Angular Js 2 - 无法绑定到“formControl”,因为它不是“输入”的已知属性
【发布时间】:2018-04-23 03:32:09
【问题描述】:

我正在尝试使用 Angular js 2 的反应式表单,并且我已经在我的组件中导入了 Formcontrol 和 ReactiveFormsModule,但是我遇到了这个错误。 enter image description here

[Product.component.ts]

【问题讨论】:

标签: angular angular-reactive-forms


【解决方案1】:

这在技术上不是重复的,因为在已标记为重复的问题中,需要在 ngModule 中标记 FormsModule。但情况类似。您需要在ngModule 中标记ReactiveFormsModule,而不是组件。

@NgModule({
  imports: [ ReactiveFormsModule, ....],
  // ....
})

【讨论】:

    猜你喜欢
    • 2016-12-18
    • 2016-12-17
    • 2019-02-21
    • 2017-11-18
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 2020-11-19
    相关资源
    最近更新 更多