我剛剛從Angular 1移動到了2,現在我將創建一個spring2 mvc maven webapp,並在其前端使用angular2。在Spring webapp中使用angular2 WITHOUT node.js
但在互聯網上的任何地方,我都看到有人使用node.js來獲取必要的庫&插件。有沒有一種方法可以爲此使用Maven依賴關係?
應用結構:
_ main
_ java
_ resources
_ webapp
_ components
_ app.component.ts
_ img
_ WEB-INF
_ index.html
_ main.ts
main.ts
//getting an error on the bootstrap import
//because the angular2 folders aren't there because there is no node
import {bootstrap} from 'angular2/platform/browser'
import {AppComponent} from './components/app.component.ts'
bootstrap(AppComponent);
http://stackoverflow.com/a/17104456/755183 – hahn
如果你想用Maven管理前端依賴項,你應該檢查[WebJars](http://www.webjars.org/)項目。還有如何從Maven調用基於節點的工具(如NPM,Bower或[JSPM](http://jspm.io/)) - 檢查[maven-frontend-plugin](https://github.com)/eirslett/frontend-maven-plugin)(這是我更喜歡的)。 –