分离Angularjs和Rails应用作为独立组件 [英] Separating Angularjs and Rails apps as standalone components
问题描述
我想尝试Angularjs。不过,我一直无法决定我应该在哪里位于我的角度应用程序。
I wanted to try out Angularjs. However, I have been trouble deciding on where I should located my angular app.
我使用的后端Rails框架。我看到那里的教程全角应用生命财产/ JavaScript的文件夹下。
I am using Rails framework for the backend. I have seen tutorials where the entire angular app lives under the assets/javascript folder.
我在想,如果不是资产/ JavaScript的文件夹内的生活,我可以让它住在外面我的rails目录完全。这样的话,我有可能我的后端和前端完全分开。 (难道这建议?)。
I was wondering if instead of living within the assets/javascript folder, I could make it live outside my rails directory entirely. That way, I can potentially separate my backend and front end entirely. (Is this recommended?).
我相信资产管道也precompiles了不少资产。如果我要分离出angularjs资产,我需要precompile资产不知何故?
I believe the asset pipeline also precompiles a lot of the assets. If I were to separate out the angularjs asset, would I need to precompile the assets somehow?
感谢
推荐答案
您可以使用一个咕噜基于工作流:
You could use a grunt based workflow:
- How有很多的脚本来管理AngularJS工作流程文件
- 的http://newtriks.com/2013/06/11/automating-angularjs-with-yeoman-grunt-and-bower/
- How to manage AngularJS workflow with lots of script files
- http://newtriks.com/2013/06/11/automating-angularjs-with-yeoman-grunt-and-bower/
如果你开始去耦前端,用嘲笑的第一,所以你可以留在角而不是失去焦点后端和前端逻辑之间的切换。构建一个单页的应用程序的优点是可以独立于后端API的开发。见( http://docs.angularjs.org/api/ngMockE2E 。$ httpBackend)信息有关嘲讽的HTTP响应。
If you start with a decoupled frontend, use mocks at first so you can stay within angular and not lose focus switching between backend and frontend logic. An advantage of building a single page application is that you can develop it independently of the backend api. See (http://docs.angularjs.org/api/ngMockE2E.$httpBackend) for information about mocking http responses.
这篇关于分离Angularjs和Rails应用作为独立组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!