【发布时间】:2022-06-19 01:54:16
【问题描述】:
当我将 BrowserAnimationsModule 或 NoopAnimationsModule 添加到独立 AppComponent 的导入数组时,它会破坏应用程序。
@Component({
standalone: true,
imports: [
CommonModule,
NoopAnimationsModule,
/* ... */
],
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
这些是我在添加其中任何一个时遇到的错误:
ERROR Error: Uncaught (in promise): Error: Providers from the `BrowserModule` have already been loaded.
If you need access to common directives such as NgIf and NgFor, import the `CommonModule` instead.
Error: Providers from the `BrowserModule` have already been loaded.
If you need access to common directives such as NgIf and NgFor, import the `CommonModule` instead.
当我不添加它时,我得到这个错误:
ERROR Error: Unexpected synthetic property @transitionMessages found. Please make sure that:
- Either `BrowserAnimationsModule` or `NoopAnimationsModule` are imported in your application.
- There is corresponding configuration for the animation named `@transitionMessages` defined in
the `animations` field of the `@Component` decorator (see
https://angular.io/api/core/Component#animations).
【问题讨论】:
-
那么,这个问题不符合什么 Stack Overflow 准则?