8

我有一些代码我想问关于stackoverflow的问题。代码用 AngularJS 和 Typescript 编写,并对 $location.hash 进行操作和监视。我现在在https://github.com/svdoever/AngularJS-bookviewer的 github 上有代码。是否可以在http://plnkr.co上获得此代码,最好没有编译的 Typescript 文件?

我在https://twitter.com/filearts/status/290961349092208642读到 Typescript 应该在http://plunkr.co上得到支持。

编辑:

Bassarat 将 gh-pages 分支添加到 git 存储库的解决方案完成了这项工作。请参阅对他的回答的评论。

4

5 回答 5

6

plunker 不支持它。但是当我需要第三方库支持(例如 angularjs)时,我倾向于使用http://typescript.io/ 。否则我只是坚持使用 TypeScript Playground http://www.typescriptlang.org/Playground/

更新

您可以使用https://github.com/basarat/typescript-script(plunker示例:https ://github.com/basarat/typescript-script#plunker )在任何您喜欢的地方使用 TypeScript

也就是说,许多游乐场现在都支持 TypeScript ,包括 plunkrhttps ://github.com/ggoodman/plunker-run-plugin/blob/master/README.md (只需放在"use typescript";文件顶部并添加一个tsconfig.json文件

于 2014-02-05T04:43:13.923 回答
6

您可以使用TypeScript Compile将您的 TypeScript 文件转换为 JavaScript。

像这样引用您的 TS 文件:

<script type="text/typescript" src="app.ts"></script>

并在 HTML 正文的末尾添加这两个 JS 文件:

<script type="text/javascript" src="//niutech.github.io/typescript-compile/js/typescript.min.js"></script>
<script type="text/javascript" src="//niutech.github.io/typescript-compile/js/typescript.compile.js"></script>

Kos Prov在这里创建了一个可用的 TypeScript Plunker 。

更新

您可以使用SystemJS加载 TypeScript 文件,尽管您需要手动引导 Angular。

http://plnkr.co/edit/kFsJ7q?p=preview

于 2014-07-15T09:25:50.407 回答
1

请改用https://stackblitz.com/,angular.io上的所有实时示例现在都使用 stackblitz。

于 2018-02-27T02:17:10.947 回答
0

您可以使用 Cloud 9 或 Codio

https://c9.io

https://codio.com/

您可以从 github 克隆项目。

它就像一个 IDE,你会得到一个终端。它已安装节点。

我在 cloud 9 中测试过,但 codio 类似,你也可以使用它

您可以运行此命令来安装打字稿

npm install -g typescript

然后你可以从终端编译你的 .ts 文件。

假设你有一个文件

hello.ts

您使用以下命令编译它

tsc hello.ts

如果您在编译时遇到问题,请检查文件所在的目录。

于 2014-07-17T09:37:04.503 回答
0

http://plnkr.co/edit/NqELPE?p=preview

这是我的同事使用 Typescript 和 Angular2 编写的一个简单的 Hello World 应用程序

只需使用 Plunker 工具来包含软件包,它就可以正常工作:

<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> <script src="https://jspm.io/system@0.16.js"></script> <script src="https://code.angularjs.org/2.0.0-alpha.25/angular2.dev.js"></script>

于 2015-06-25T20:24:09.447 回答