- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
每次我从“@angular/forms”导入 FormsModule 时,都会出现以下错误:
Error: ./node_modules/@angular/forms/__ivy_ngcc__/fesm2015/forms.js 27:12
Module parse failed: Identifier 'ɵngcc0' has already been declared (27:12)
File was processed with these loaders:
* ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
* ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| */
| import * as ɵngcc0 from '@angular/core';
> import * as ɵngcc0 from '@angular/core';
| const NG_VALUE_ACCESSOR = new InjectionToken('NgValueAccessor');
|
这是我的一段代码:
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
这个问题中有趣的一点是,如果我没有在导入列表中包含 FormsModule,代码工作得很好,但是当它在列表中时,它会导致问题。简单导入 FormsModule 似乎不是问题。
我该如何解决?
最佳答案
我必须运行 npm ci
,然后再次运行 npm install
。足够了,它有效。
关于javascript - 由于错误,无法使用 Angular FormsModule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66731024/
每次我从“@angular/forms”导入 FormsModule 时,都会出现以下错误: Error: ./node_modules/@angular/forms/__ivy_ngcc__/fes
我正在尝试从 Angular 2 RC5 中的 @angular/forms@0.3.0 导入 FormsModule。应该很简单吧? import { FormsModule } from '@an
我正在浏览 Angular2 教程 https://angular.io/docs/ts/latest/tutorial/toh-pt5.html .一切都好一步路由。 Visual Studio C
我正在做 Angular2 英雄教程: https://angular.io/docs/ts/latest/tutorial/toh-pt1.html 在纯 Javascript(不是 Typescr
存在 ReactiveFormModule 和 FormsModule。 import { FormsModule, ReactiveFormsModule } from "@angular/
TestBed.configureTestingModule({ imports: [ FormsModule, ReactiveFormsModule,
我收到 Can't bind to 'ngModel' since it isn't a known property of 'input'. 错误,尽管我已经导入了 FormsModule . pa
我正在使用带有延迟加载模块的 Angular。每个组件都有自己的模块。如果我在根模块 (app.module) 中导入一个模块,它一定能正常工作。例如,我在 app.module 中导入了 HttpC
这个问题在这里已经有了答案: Angular 2+ and Observables: Can't bind to 'ngModel' since it isn't a known property
我刚看到这个question但我仍然有同样的错误。我有一个共享模块,我将其导入到我的功能模块中。但我也尝试过将 FormsModule、ReactiveFormsModule 模块直接导入到我的功能模
我是 Angular 的新手。我开始了英雄之旅来学习它。因此,我创建了一个具有双向 绑定(bind)的app.component。 import { Component } from '@angula
我被困住了“无法绑定(bind)到‘ngModule’,因为它不是‘select’的已知属性。”错误。该解决方案应该是在 app.module.shared.ts 文件中导入 FormsModule。
我是一名优秀的程序员,十分优秀!