Viewing AngularJS and Rails requires a page refresh

I have a Rails application with AngularJS in some views. Whenever I click on a link that brings me to a page, let's say /certificationsI see this

bad reload

Then when I reload the page or request it by pressing enter in the url line, it works and shows it

good reload

Is there any difference in how these two pages reload, which rotate AngularJS. Does the user and router need angular or something else? I put the view code and controller below. Thanks for the help!

Controller:

@aquaticsApp = angular.module 'aquaticsApp',
  ['ngResource', 'aquaticsAppFilters']


@aquaticsApp.controller 'CertsCtrl', ['$scope', 'Certs',
  @CertsCtrl = ($scope, Certs) ->
    $scope.formatDate = (dateString)  ->
      d = new Date(dateString)

      curr_month = d.getMonth() + 1
      curr_date = d.getDate()
      curr_year = d.getFullYear()

      "#{curr_month}/#{curr_date}/#{curr_year}"

    $scope.sorter =
      value: 'firstName'

    Certs.get (data) ->
      $scope.certNames = data.certification_names
      $scope.users = data.users
]

View:

<div ng-app='aquaticsApp' class='table-responsive'>
  <table ng-controller='CertsCtrl' class='table table-hover table-condensed'>
    <thead>
      <tr>
        <th ng-click='sorter.value="lastName"'>Last Name</th>
        <th ng-click='sorter.value="firstName"'>First Name</th>
        <th ng-click='sorter.value="location"'>Location</th>
        <th ng-repeat='certName in certNames' ng-click='sorter.value=certName.name'>
          {{certName.name}}
        </th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat='userData in users | orderBy:sorter.value'>
        <td>{{userData.lastName}}</td>
        <td>{{userData.firstName}}</td>
        <td>{{userData.location}}</td>
        <td ng-repeat='certName in certNames' class='{{userData[certName.name + "class"]}}'>
          {{formatDate(userData[certName.name])}}
        </td>
        </td>
      </tr>
    </tbody>
  </table>
</div>
+4
source share
1 answer

JQuery Rails 4.

Turbolinks , , . , turbolinks, , SO, .

+3

All Articles