Plunker with AngularJS and Typescript possible?

随声附和 提交于 2019-12-03 13:46:30

It isn't supported by plunker. But I tend to use http://typescript.io/ when I need third party lib support (e.g. angularjs). Otherwise I just stick with TypeScript Playground http://www.typescriptlang.org/Playground/

Update

You can use TypeScript anywhere you like using https://github.com/basarat/typescript-script (plunker sample : https://github.com/basarat/typescript-script#plunker)

That said many playgrounds now support TypeScript natively including plunkr : https://github.com/ggoodman/plunker-run-plugin/blob/master/README.md (just put "use typescript"; at the top of your file and add a tsconfig.json file 🌹

Blake Bowen

You can use TypeScript Compile to transform your TypeScript files into JavaScript.

Reference your TS files like this:

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

And add these two JS files at the end of the HTML body:

<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 created a working TypeScript Plunker here.

Update

You can use SystemJS to load TypeScript files, although you'll need to manually bootstrap Angular.

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

Use https://stackblitz.com/ instead, all live examples on angular.io use stackblitz now.

You could use Cloud 9 or Codio

https://c9.io

https://codio.com/

You can clone projects from github.

It is like an IDE and you will get a terminal. It has node installed.

I tested in cloud 9, but codio is similar you can use it too

You can run this command to install typescript

npm install -g typescript

then you can compile your .ts file from the terminal.

lets say that you have a file

hello.ts

you compile it using the following command

tsc hello.ts

If you are facing issues with compiling, please check the directory where your file is at.

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

Here's a simple Hello World app that my colleague wrote that uses Typescript and Angular2

Simply use the Plunker tool for including packages and it works fine:

<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>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!