Rails 4 + AngularJS: App.js config and run functions don't work -


i'm working rails 4 , angularjs. i've got app working. controllers, directives, services, etc. however, main app.js file refuses fire config , run functions. i've got console.logs in there test how far gets. here's code:

angular-app/app.js

'use strict';  console.log('we see app.js file'); // works  var app = angular.module('bruno', [])  console.log(app) //this works  // stops working app.config(function ($httpprovider) {     alert('config'); // can't see     $httpprovider.defaults.headers.common['x-csrf-token'] = $('meta[name=csrf-token]').attr('content'); })  app.run(function () {     console.log('app running'); // can't see }); 

like said, other controllers working fine. console doesn't show any errors , loads should.

rails application.js file:

//= require angular-app/app //= require_tree ./angular-app/templates //= require_tree ./angular-app/modules //= require_tree ./angular-app/filters //= require_tree ./angular-app/directives //= require_tree ./angular-app/models //= require_tree ./angular-app/services //= require_tree ./angular-app/controllers 

i've re-written every way can think of, no avail. i'm kinda stumped. i've done , without var app. hoping wonderful community can @ least me see can't.


additional info

  • i'm using gem 'angular-rails-templates'
  • rails 4.2.3
  • angularjs 1.3.16

if need else me ask. knows, maybe tomorrow morning i'll see things differently. :-)

as turns out, mistakenly re-using same module name inside controller. overwriting module name in app.js. fixed now.


Comments

Popular posts from this blog

What Are The Best Universities In The World?

Hard vs. Soft Water: What's The Difference?

Why People Get Naked Before Freezing To Death