如何将数据从角度传递到rails

时间:2014-08-12 16:25:01

标签: ruby-on-rails angularjs

我是一个非常新的角度,只有一周大。我的问题是如何将数据从角度传递到轨道?如您所见,我只需将{{entry.name}}中输入的内容保存到rails中。谢谢

          <fieldset>
               <div class="row" ng-controller="tagForm">
                 <fieldset >
                 <div ng-click="addEntry()">
                  <div class="col-xs-12 col-sm-12 col-md-10 ">
                     <%= f.text_field :description,:placeholder => 'What are your area of expertise',:'ng-model'=> "newEntry.name", :class => 'form-control border' %>
                  </div>
                  <div class="col-xs-12 col-md-2 center form-button" >

                   <input type="button" value="Add" class="btn btn-orange btn-add" >
                  </div>
                  <div class="col-md-8 col-sm-offset-2" id="up" ><br/>
                     <span class="label label-primary" ng-repeat="entry in entries">{{entry.name}}</span>
                  </div>
                  </div>
                  </fieldset>

1 个答案:

答案 0 :(得分:0)

如果要与外部服务器通信。您应该使用$http$resource,具体取决于服务器的体系结构,作为起点https://docs.angularjs.org/api/ng/service/ $ http和https://docs.angularjs.org/api/ngResource/service/ $ resource

的文档