gpt4 book ai didi

Angular2 CLI 工作

转载 作者:太空狗 更新时间:2023-10-29 18:33:59 25 4
gpt4 key购买 nike

angular CLI 发布后,我决定使用 angular CLI,但从一开始导致一些尚未清除的困惑所以希望这里的某个地方帮助我:-

  1. index.html 中,我发现了一些惊人的 Angular 插值语法,它们在我们的应用程序中的作用是什么?

语法类似 -

{{#unless environment.production}}
{{/unless}}
{{#each scripts.polyfills}}
<script src="{{.}}"></script>{{/each}}

what does `/` this mean in {{/unless}}
and here `#` in the {{#each ...}} ??
  1. 当我运行命令 ng g component demo 时,它以完美的方式创建组件,但在创建后找到一个文件为每个组件命名为 index.tsindex.ts 在这里的作用是什么?

  2. 在 CLI 之前,我使用 gulp 任务来执行编译(*.ts 到 *.js),在 CLI 中如何以及在何处执行这些操作?

  3. angular-cli.json 文件的作用是什么?

如有任何帮助,我们将不胜感激。

最佳答案

  1. 此命令添加重要的脚本导入,例如对于 SystemJS 到最终的“编译”index.html(您将在 dist 文件夹中看到)
  2. 创建此文件是为了让 src/system-config.ts 可以在不知道其名称的情况下轻松访问您生成的 TS 文件。当您查看生成的 index.ts 时,它只是对实际类名的引用。
  3. 构建由 NPM 处理,查看 package.json > scripts-section ( https://docs.npmjs.com/misc/scripts )
  4. angular-cli.json 为 angular-cli 提供元数据。通常你不需要在那里改变任何东西

有用的资源:

请注意,cli-Tool 仍处于测试阶段,因此请仔细查看 github 上 Unresolved 问题

关于Angular2 CLI 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37588579/

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