In my development environment my angular pages respond just fine. Once changing my environment to production when I visit my pages with angular content I get an error in the console saying:
Error: [ng:areq] Argument 'SwimmersCtrl' is not a function, got undefined
Here is my modules.js.coffee file:
@comsatrack = angular.module 'comsatrack',
['ngResource', 'comsatrackFilters', 'ngAnimate']
Here is my application.js.coffee file:
#= require jquery
#= require jquery.turbolinks
#= require jquery_ujs
#= require bootstrap
#= require turbolinks
#= require angular
#= require angular-resource
#= require angular-animate
#= require modules
#= require_tree .
Here is my swimmers.js.coffee file:
@comsatrack.controller 'SwimmersCtrl', ['$scope', 'Swimmers',
@SwimmersCtrl = ($scope, Swimmers) ->
$scope.predicate =
value: 'last_name'
$scope.alerts = []
$scope.addAlert = (swimmer) ->
$scope.alerts = []
$scope.alerts.push
type: "success"
msg: "#{swimmer.first_name}
#{swimmer.last_name} has been checked in!"
$scope.closeAlert = (index) ->
$scope.alerts.splice index, 1
$scope.showPhone = (swimmer) ->
swimmer.phone_number?
$scope.hideCheckin = (swimmer) ->
swimmer.phone_number?
$scope.totalDisplayed = 10
$scope.loadMore = ->
$scope.totalDisplayed += 100
Swimmers.index (data) ->
$scope.Swimmers = data
]
On the index page I access this controller via:
<div ng-app='comsatrack'>
<div ng-controller='SwimmersCtrl'>
<!-- index page content -->
</div>
</div>
I have double checked to make sure that I have not double initialized my module anywhere else in my app.
Thank you in advance for any help related to this issue. I would also appreciate any feedback or comments on the code, unrelated to the issue.