【问题标题】:How to open standalone angular2 and TypeScript project in visual studio如何在 Visual Studio 中打开独立的 angular2 和 TypeScript 项目
【发布时间】:2017-03-17 07:15:36
【问题描述】:

如何在没有 npm/nodejs 的 Visual Studio 中打开 angular2 和 TypeScript 项目。 我需要在没有网络的计算机上打开项目。

谢谢

【问题讨论】:

  • 您只需要 Node_modules 文件夹即可运行 Angular 2 应用程序
  • @Bean0341, 如何将打字稿编译成 js 文件?
  • aww 是的,我现在明白了这个问题,你必须有一些东西来管理打字稿转换......我在这里没用:p 但是我也听说过 gulp 但如果你要去使用 gulp 那么你还不如使用 npm....

标签: node.js angular typescript npm


【解决方案1】:

在 VS 中创建新项目 -> TypeScript -> 使用 TypeScript 的 HTML 应用程序。默认情况下,您将设置 Typescript 转译器。现在您需要 Angular 2。根据this answer,您需要将这些脚本添加到您的页面:

<script src="https://code.angularjs.org/2.0.0-beta.2/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.2/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.2/angular2.dev.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.2/http.dev.js">

您还必须按照我之前提供的示例中所示配置 SystemJS。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-05
    • 1970-01-01
    相关资源
    最近更新 更多