http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/javascript
1. 添加gem
gem 'sprockets', '2.12.3' #默認sporckets的版本有bughtml
2. app/assets/javascripts/ng-app/app.js中代碼
//$locationProvider.html5Mode(true); //這行須要註釋html5
3. bower有三種方式java
(1)bower.json http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/node
(2)Bowerfile http://angular-rails.com/bootstrap.htmlangularjs
(3)bower init https://thinkster.io/angular-rails/json
4. rails route有兩種方式bootstrap
(1)有yield http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/後端
(2)沒有yield https://thinkster.io/angular-rails/app
心得:
angluar和rails結合有些不三不四,兩個層面的路由,兩個層面的局部模板結合在一塊兒很複雜,angular和rails各自的特性都沒法充分發揮
angluar最合適的方式仍是單獨使用,後端用很簡單的腳本,好比node.js