angular+rails集成实战
http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/
1. 添加gem
gem 'sprockets', '2.12.3' #默认sporckets的版本有bug
2. app/assets/javascripts/ng-app/app.js中代码
//$locationProvider.html5Mode(true); //这行需要注释
3. bower有三种方式
(1)bower.json http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/
(2)Bowerfile http://angular-rails.com/bootstrap.html
(3)bower init https://thinkster.io/angular-rails/
4. rails route有两种方式
(1)有yield http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/
(2)没有yield https://thinkster.io/angular-rails/
心得:
angluar和rails结合有些不伦不类,两个层面的路由,两个层面的局部模板结合在一起很复杂,angular和rails各自的特性都无法充分发挥
angluar最合适的方式还是单独使用,后端用很简单的脚本,比如node.js
家教呢:www.jiajiaone.com