I'm using angularjs-rails gem.
I've created angular_app folder in assets, and have angular_app/controllers/phoneListController.js.coffee, and angular_app/modules/phoneCatApp.js.coffee (*yeah you're right I'm doing angular's phone tutorial ). So angular_app/controllers/phoneListController.js.coffee
has:
phonecatApp.controller 'PhoneListController', ($scope) ->
$scope.phones = [
{ 'name': 'Nexus S'
'snippet': 'Fast just got faster with Nexus S.'
}
{
'name': 'Motorola XOOM™ with Wi-Fi'
'snippet': 'The Next, Next Generation tablet.'
}
{
'name': 'MOTOROLA XOOM™'
'snippet': 'The Next, Next Generation tablet.'
}
]
return
angular_app/modules/phoneCatApp.js.coffee
has:
phonecatApp = angular.module('phonecatApp', [])
Every thing works fine if I use vanila js in angular_app/modules/phoneCatApp.js.coffee
using `phonecatApp = angular.module('phonecatApp', [])`` (with backsticks).
So problem is that coffee covers all in anonymous function with ().call.this. What should I do to make it work in coffee?
angular.module('phonecatApp').controller ...
with assets pipeline directiverequire <file with your module definition>
. Local variables are not passed between coffee files. – BroiSatse Apr 1 at 9:11