我为什么要使用角与Ruby on Rails的? [英] Why would I want to use Angular with Ruby on Rails?

查看:185
本文介绍了我为什么要使用角与Ruby on Rails的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个学习的CS和最近我有我自己真的很享受学习的Web开发。

I'm a studying CS and lately I've got myself really enjoying learning about web development..

现在,我已经努力学习AngularJS了几次,但后来我想更专注于后端的第一,因为我已经知道像HTML / CSS / JS这使得前端的相当一部分的东西,所以想看看有什么后台感觉就像..

Now, I have tried to learn AngularJS for a few times but then I wanted to focus more on backend first, since I already know the stuff like html/css/js which makes good part of frontend so wanted to see what backend feels like..

于是我开始学习Rails的。现在,既然用努力​​学习AngularJS我才知道这是所有关于我的MVC previous尝试,从一个发送数据到另一个等等。我的问题是,乍一看至少,滑轨似乎真的相似的方式工作。现在的问题是,为什么会有人想在同一时间同时使用AngularJS和Rails的时候,至少在新手的眼睛 - > Rails的看来,它可以同时处理后端和前端?就像,意见是我们的前端,我们可以在这些.html.erb文件中使用的CSS / JS,那不是被视为毕竟前台?

So I started learning Rails.. Now, since with my previous attempts of trying to learn AngularJS I learned that it is all about MVC, sending data from one to another etc.. My problem is, at first glance at least, Rails seems to work in the really similar fashion. The question is, why would anyone want to use both AngularJS and Rails at the same time, when, at least in the newbie's eyes -> Rails seems that it can handle both backend and frontend? Like, views are our frontend, and we can use css/js in those .html.erb files, wouldn't that be considered frontend after all?

现在,我几乎肯定有一个很好的回答这个,因为谷歌搜索为什么要用角与轨通常是与向你解释如何将其整合教程的结果,我只是想某些原因使我不会T像现在一样困惑。

Now, I'm almost positive there is a good answer to this since googling "why use angular with rails" usually comes with results of tutorials that explain to you how to integrate them, I just want some reasons so that I wouldn't be as confused as right now..

谢谢!

推荐答案

Rails是一个服务器端框架,生成HTML,JSON和JavaScript以及CSS管理和图像的资产。

Rails is a server-side framework that produces HTML, JSON, and JavaScript as well as manages CSS and image assets.

AngularJS是一个客户端框架。一般情况下,没有一个服务器组件它真的做不到了。

AngularJS is a client-side framework. Generally, without a server component it really can't do much.

在默认情况下Rails的没有一个客户端框架。您可以使用EmberJS,角,或其他人,使您的客户端界面更加敏感和灵活。单独导轨不能做到这一点,就不能在浏览器中运行。

By default Rails doesn't have a client-side framework. You can use EmberJS, Angular, or others to make your client-side interface more responsive and flexible. Rails alone can't do this, it can't run in your browser.

同样,AngularJS不能在您的服务器上运行。你需要把它们结合起来。

Likewise, AngularJS can't run on your server. You need to combine them.

这篇关于我为什么要使用角与Ruby on Rails的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆