[英]How to get angular2 to work in eclipse with typescript
所以我開始研究angular2,因為我看到很多關於打字稿的引用,我試圖從javascript切換到它。 問題是,我看到了一個很好的小指南我可以按照eclipse安裝它(角度,javascript,在角度主頁上啟動5分鍾指南代碼所需的一切),所以我做了它並設法得到它工作。
現在我想對打字稿做同樣的事情,但我發現自己失去了因為它似乎沒有工作,我無法啟動代碼,就像node.js不再工作,但因為我不知道預期的結果是什么,我不確定缺少什么。
例如,我做了5分鍾的指導,並注意到我沒有安裝模塊,也沒有准備好任何運行配置,事實上,我無法設法運行任何打字機代碼我嘗試去做。
我做的是:
1-安裝Eclipse Mars,其他人使用舊版本
2-安裝Node.js.
3-安裝WildFly Server
4-安裝TypeScript插件https://marketplace.eclipse.org/content/typescript
5-在eclipse中導入我的項目,你可能需要創建一個新的靜態web項目並在那里添加你的文件。 5分鍾快速啟動不是eclipse Web項目,因此您可能無法導入它。 不要忘記使用您擁有的節點模塊復制和通過相同的結構
6-右鍵單擊項目>配置>啟用Typescript Builder
7-右鍵單擊項目>屬性> TypeScript>編譯器,並配置如下:
我希望這會為你做到。
請記住,此插件不尊重json配置文件,因此您必須手動執行此操作,如屏幕截圖所示。 此外,如果要為組件構造函數提供參數,則會出現錯誤。 如果你有這些,請告訴我。 另外要提到的是,使用像@Input這樣的注釋是行不通的,你必須在@Component注釋中使用輸入:[]。
你可以嘗試在火星上添加這些插件:
這兩個正在孵化,但已經提供了良好的功能。 還有一個,我沒有嘗試,但有一些受歡迎程度:
Eclipse> = Neon
sudo npm install -g angular-cli
( ng help
必須工作) .ts
文件 Eclipse氧氣
默認的javascript安裝,然后從這里添加angular 2 / typescript的默認免費插件:
angular2.ide - http://oss.opensagres.fr/angular2-eclipse/1.3.0/
安裝完成后,我打開了現有的Angular 4 / TS項目,工作正常。 然后我從http://www.liclipse.com/text/updates安裝了對.scss的支持。 全部設置並使用Typescript 2.4.1 / nodejs v6.9.4進行配置。
但是幾天之內它根本無法打開.ts文件。 重新安裝ng插件沒有解決它,我卸載了liclipse插件,也沒有改變。 它基本上使eclipse無法用於ng4項目。
日志顯示以下錯誤。
org.eclipse.core.runtime.CoreException: Plug-in "ts.eclipse.ide.jsdt.ui" was unable to instantiate class "ts.eclipse.ide.jsdt.internal.ui.editor.TypeScriptEditor".
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:188)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
...
Caused by: java.lang.NoClassDefFoundError: org/eclipse/wst/jsdt/ui/text/JavaScriptSourceViewerConfiguration
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.wst.jsdt.ui (441).
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:112)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
...
Caused by: java.lang.ClassFormatError: Name index 1 in LocalVariableTable has bad constant type in class file org/eclipse/wst/jsdt/internal/core/JavaModelManager
我找到了TypeEcs
插件
它在下面提供。
•語法突出顯示
•代碼完成
•代碼大綱
•查找參考文獻
•重命名/重構
•打開類型
•代碼編譯
•格式代碼
•評論代碼
•公開宣言
•Mark Occurences
•鍵入腳本調試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.