百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

angular-rails

> 编程语言
开源

此库为 Rails 应用程序添加了 AngularJS 支持

195 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

此库为 Rails 应用程序添加了 AngularJS 支持

Angular-Rails - The HTML6 Shiv

This project lets you use angularjs with the yummy Rails 3.1 asset pipeline. The eventual goal is to have it integrate scaffolding with test support.

Warning!! Abandoned Fork

This library hasn't been updated for a while. Rails 3 is now Rails 5. Angularjs 1 is now Angular 7. Use at your peril :).

Credit to backbone-rails

The initial fork/inspiration was from the backbone-rails project.

Assumptions

  • Rails 3.1 - For the asset pipeline
  • Coffeescript - Because less LOC means less bugs, plus it is the Rails Way, like it or not.
  • Ruby 1.9.2 - Because I like the syntax enhancements (but if there's an outcry I can support 1.8.7)
  • RSpec - This is a loose requirement, but all specs generated will be, well rspec. Once we have end-to-end coverage, someone can add a patch for testunit (or mini*) support.
  • RESTful controllers - another loose requirement, but it will help things be smoother for you. The goal is as little friction as possible between the front and back ends, without resorting to Node.js :).

Installation

Add to your gemfile:

gem "angular-rails"

And bundle away. To bootstrap things then type:

rails g angular:install

Layout and namespacing

Running rails g angular:install will create the following directory structure under app/assets/javascripts/angular:

controllers/
filters/
services/
widgets/

It will also generate a templates/ directory under app assets, where view templates can be stored. This lets you use haml, etc. for your angular views.

It will also add to the application.js file the appropriate requires.

Generators

angular-rails provides a simple generator to help get you started using angular.js with rails 3.1. The generators will only create client side code (javascript).

So far we have a controller generator which generates a controller file if you rum

rails g angular:controller MODELNAME

This file is empty except for the class declaration, but I will be adding some RESTful controller functionality shortly.

angle-up

In an attempt to DRY up angular apps I added the angle-up javascript file to the assets path. angle-up attempts to add some opinions to angular apps.

Example Usage

Created a new rails 3.1 application called blog.

rails new blog

Edit your Gemfile and add

gem 'angular-rails'

Install the gem and generate scaffolding.

bundle install
rails g angular:install

You now have installed the angular-rails gem, setup a default directory structure for your frontend angular code.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言