gpt4 book ai didi

Dart:如何修复条件?

转载 作者:行者123 更新时间:2023-12-01 06:19:19 25 4
gpt4 key购买 nike

我是新手。我使用 IDEA 模板创建了一个 angular 应用程序并插入示例中的代码:

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

出现错误:

[INFO] ------------------------------------------------------------------------ [INFO] Starting Build [INFO] Updating asset graph completed, took 16ms [SEVERE] angular on lib/app_component.dart: Template parse errors: line 6, column 4 of AppComponent: ParseErrorLevel.FATAL: Can't bind to 'ngIf' since it isn't an input of any bound directive. Please check that the spelling is correct, and that the intended directive is included in the host component's list of directives. ^^^^^^^^^^^^ [INFO] Running build completed, took 650ms [INFO] Caching finalized dependency graph completed, took 853ms [SEVERE] build_web_compilers|entrypoint on web/main.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).

Please check the following imports:

import 'package:untitled1/app_component.template.dart' as ng; from untitled1|web/main.dart at 2:1

[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).

Please check the following imports:

import 'package:untitled1/app_component.template.dart' as ng; from untitled1|test/app_test.dart at 5:1

[SEVERE] build_web_compilers|entrypoint on test/app_test.dart.browser_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).

Please check the following imports:

import 'package:untitled1/app_component.template.dart' as ng; from untitled1|test/app_test.dart at 5:1

[SEVERE] Failed after 1.6s



怎么修?

最佳答案

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

import 'package:angular/angular.dart'

...

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

关于Dart:如何修复条件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53352937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com