首页 > 解决方案 > Angular Dart 教程 - 无法找到某些源的模块

问题描述

我正在尝试遵循 Angular Dart 教程(https://webdev.dartlang.org/angular/tutorial/toh-pt1),但在添加了一些使用 ngModel 指令的 html 后卡住了。

根据教程,为了使用 ngModel 指令,必须将“angular_forms:^2.0.0”添加到 pubspec.yaml,导入“package:angular_forms/angular_forms.dart”并将“formDirectives”添加到组件指令. 我做了所有这些,包括运行“pub get”来获取依赖项,但是当我运行“webdev serve”时,我收到以下错误:

[SEVERE] build_web_compilers|entrypoint on test/app_test.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).

我错过了什么?

标签: angular-dart

解决方案


我有同样的问题。我认为它没有在 tute 中明确提及,但是在将 angular_forms 依赖项添加到 pubspec.yaml 文件后,您需要使用以下方法引入这个新依赖项:

pub get

希望能帮助到你!


推荐阅读