如何使用typescript让angular2在eclipse中工作 [英] How to get angular2 to work in eclipse with typescript

查看:130
本文介绍了如何使用typescript让angular2在eclipse中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我开始研究angular2,因为我看到很多关于打字稿的引用,我试图从javascript切换到它。问题是,我看到了一个很好的小指南我可以按照eclipse安装它(角度,javascript,在角度主页上启动5分钟指南代码所需的一切),所以我做了它并设法得到它工作。



现在我想对打字稿做同样的事情,但我发现自己失去了因为它似乎不起作用,我无法启动代码,它就像node.js不再工作了,但由于我不知道预期的结果是什么,我不确定缺少什么。



例如,我我做了5分钟的指导和注意,因为我没有安装模块,也没有准备好任何运行配置,事实上,我无法像我尝试的任何打字机代码一样运行。

解决方案

我做的是:



1-安装Eclipse Mars,其他人使用旧版本



2-安装Node.js



3-安装WildFly服务器



4-我nstall TypeScript插件



我希望这能为你做到。



请记住,此插件不尊重json配置文件,因此您必须手动执行此操作,如屏幕截图所示。此外,如果要为组件构造函数提供参数,则会出现错误。如果你有这些,请告诉我。另外要提到的是,使用像@Input这样的注释是行不通的,你必须在@Component注释中使用输入:[]。


So I was starting researching about angular2 and since I saw so many references to typescript being prefered I am trying to switch to it from javascript. Problem is, I saw a nice little guide I could follow to install it all in eclipse (angular, javascript, everything needed to launch the 5 minute guide code on the main page of angular), so I did it and managed to get it to work.

Now I would like to do the same with typescript, but I find myself lost since it doesn't seem to be working, I can't launch code, it's like node.js isn't working anymore, but since I do not know what the expected result is, I am not sure what is missing.

For example, I re did the 5 minute guide and notice as a difference that I do not have the installation of the modules, nor any run-as configuration ready, in fact, I can't manage to run as any typescript code I try to do.

解决方案

What I did was:

1- Install Eclipse Mars, other guys uses older versions

2- Install Node.js

3- Install WildFly Server

4- Install TypeScript plugin https://marketplace.eclipse.org/content/typescript

5- Import my project in eclipse, you may have to create a new static web project and add your files in there. The 5 minute quick start is not an eclipse web project so you may not be able to import this. Do not forget to copy and past the same structure with the node modules that you have

6- Right click on the project > Configure > Enable Typescript Builder

7- Right Click the project > Properties > TypeScript > Compiler and configure as follows:

I hope this will do it for you.

Remember, this plugin does not respect json configuration file, so you have to do this manually as in the screenshot. Also, if you are going to provide arguments to your component constructor, You will have errors. Let me know if you got those. Another thing to mention is that using some annotations like @Input will not work, you will have to use inputs:[] inside your @Component annotation.

这篇关于如何使用typescript让angular2在eclipse中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆