代码之家  ›  专栏  ›  技术社区  ›  VINET

Dart:如何修复这种情况?

  •  1
  • VINET  · 技术社区  · 7 年前

    <p *ngIf="true">
        Expression is true and ngIf is true.
        This paragraph is in the DOM.
    </p>
    

    出现以下错误:

    [信息] ------------------------------------------------------------------------[INFO]开始构建[INFO]更新资产图已完成,耗时16毫秒 lib/app_component.dart上的[严重]角度:模板分析错误: AppComponent第4列第6行:ParseErrorLevel.FATAL:无法绑定到 拼写正确,预期指令正确 ^^^^^^^^^^^^[信息]运行生成已完成,需要650ms[信息]缓存 在web/main.dart(缓存)上构建web编译器入口点:无法 查找某些源的模块,这通常是 dev_依赖项需要移动到真正的依赖项),或者构建失败

    请检查以下导入内容:

    import 'package:untitled1/app_component.template.dart' as ng; 从…起

    [严重]构建web编译器|测试入口点/app_test.dart (缓存):无法找到某些源的模块,这通常是 导入错误、包中缺少依赖项(或 可能一个dev_依赖项需要移动到一个真正的依赖项),或者

    请检查以下导入内容:

    将“package:untitled1/app_component.template.dart”作为ng导入;

    [严重]构建web编译器|入口点 对于某些来源,这通常是由于导入错误或 包中缺少依赖项(或者可能需要删除dev_依赖项) 移动到真正的依赖项),或生成失败(如果导入

    请检查以下导入内容:

    将“package:untitled1/app_component.template.dart”作为ng导入; 不间断1 |测试/应用|测试。以5:1的速度飞镖

    [严重]在1.6s后失败

    1 回复  |  直到 7 年前
        1
  •  1
  •   Günter Zöchbauer    7 年前

    您需要在中列出模板中使用的指令 @Component()

    import 'package:angular/angular.dart'
    
    ...
    
    @Component(
      selector: 'foo-bar',
      templateUrl: 'foo_bar.html',
      directives: [coreDirectives /* or NgIf */],
    )