我开始在 Rails 应用程序上使用 AngularJs。我想知道如何管理 rails 和 angularjs 之间的通信。我想用 rails 生成模板,然后 angularjs 将执行控制器来更新视图:
.span6.box.applications{ "ng-controller" => "ApplicationListCtrl"}
.padding5.clearfix
.clearfix
%h2.inline.pull-left.no-border= t('home.titles.applications')
.content.top5
- if @applications.count > 0
%table.table.table-striped
%thead
%tr
%th= Application.human_attribute_name(:id)
%th= Application.human_attribute_name(:name)
%th
%tbody
%tr{ "ng-repeat" => "application in applications" }
/ %div{ "ng-include" => "", "src" => "'/applications/new.html'" }
%td {{application.name}}
%td {{application.name}}
%td{ width: "50px"}
.pull-right
- if can? :edit, Application
%span.fui-gear{"data-toggle" => "tooltip", :title => t('form.settings'), "ng-click" => "edit()" }
- if can? :read, Application
%span.fui-search.left10{"data-toggle" => "tooltip", :title => t('form.show'), "ng-click" => "show()"}
问题是我的视觉效果很差。它首先向我显示:
然后它将更改为:
它有效,但我有视觉效果。我该如何管理。如何使用 AngularJs 创建可重用的模块?