Search code examples
ruby-on-railsangularjsangular-moment

How to add angularMoment to Rails manifest file?


I'm trying to use angular-moment (https://github.com/urish/angular-moment) in an Angular/Rails applicaton.

I've installed angular-moment and angular with bower.

Angular works and is being used in the app, but angular-moment crashes the app as soon as I add it as a dependency in the angular module.

Proposed solution:

I thought the solution might be to add angular-moment to the rails manifest file, application.js. But its also not working.

Application.js

//= require angular
//= require angularMoment

Bower.json

"dependencies": {
  "angular": "^1.5.5",
  "angular-moment": "^0.10.3"
}

App.js

angular.module('App', ['angularMoment'])

Is there a known reason why this might not work?

Or some alternative you would recommend?


Solution

  • Solution

    Use //= require angular-moment in the manifest file, not //= require angularMoment.

    Note to self - required file in application.js should match the file name in bower.json, not the name used in the Angular injection.