Rails 4, Foundation 6, Angular 1.5.0

Hi All,

I have a Rails app that’s been running in Production in my office for a
few
years now. (Rails 4.1 with Foundation 5).

I have attempted to update it to Rails 4.2.6, with Foundation 6 and
AngularJS 1.5.0 - it’s angular I want for the next few features.

In Development on localhost (OSX) everything is fine and dandy.

In Production, on a Centos Server, I get the following error from
Angular
when the pages load:

Error: [$injector:modulerr] Failed to instantiate module App due to:
[$injector:unpr] Unknown provider: e

I’m assuming this may an issue with the asset pipeline, and will be
looking
into this further this weekend, but was hoping there may be someone with
Rails/Angular experience that could point me to the problem when
deploying
to Production. I’ve spent a good portion of the week on this so far, so
a
few tips in the right direction would be really helpful.

I’ve got Angular set up with a few node/express apps, and find it
excellent
to work with, hence why I want it included in this rails app.

Production Environment:

Ruby 2.3.0 managed by rbenv
Apache / Passenger

Gems:

angularjs-rails
foundation-rails
jquery-rails

(+ all the usual suspects, if you want the full list, just say so)

assets/js/application.js
//= require jquery
//= require jquery_ujs
//= require foundation
//= require angular
//= require angular-resource
//= require jquery_nested_form
//= require_tree .

$(function(){ $(document).foundation(); });

assets/js/angular/app.js.coffee
app = angular.module(“App”, [“ngResource”])

app.config ($httpProvider) ->
authToken = $(“meta[name=“csrf-token”]”).attr(“content”)
$httpProvider.defaults.headers.common[“X-CSRF-TOKEN”] = authToken

app.controller “AppCtrl”, ["$scope","$log", ($scope, $log) -> ]

Any help is greatly appreciated, and if you need anything more from me,
let
me know and I’ll be happy to supply.

Thanks

Paul

On Fri, Apr 8, 2016 at 7:54 AM, paul h [email protected] wrote:

In Development on localhost (OSX) everything is fine and dandy.

In Production, on a Centos Server, I get the following error from Angular

No experience with Angular, but the first things I’d ask are:

  1. Is there anything unusual in the production logs at startup?

  2. Does it run on OSX in production mode?

  3. Does it run on CentOS in development mode?

If you don’t want to disrupt your production server you can bring up
a CentOS VM on your Mac to simulate the prod. environment.

Good luck!

Hassan S. ------------------------ [email protected]

twitter: @hassan
Consulting Availability : Silicon Valley or remote

Hi Hassan,

Thanks for the tips below, they helped.

Finally fixed it by instantiating the angular app in application.js
rather
than in it’s own app.js.coffee file and letting sprockets handle it.

Thanks for your time.

Paul

On Friday, April 8, 2016 at 4:32:07 PM UTC+1, Hassan S. wrote:

  1. Is there anything unusual in the production logs at startup?
  1. Does it run on OSX in production mode?