I have the following module called EnvConfigurationService,js.erb:
#../angular/services/config/EnvConfigurationService,js.erb
angular.module('mgApp.services').factory('EnvConfigurationService', function () {
return {
getMySecretKey: function () {
return "<%= ENV['MY_SECRET_KEY'] %>";
}
}
});
The intention is to provide access to 'MY_SECRET_KEY' from different angular and regular js classes. Like the following on userController.js:
angular.module('mgApp.controllers').controller('userController', ['$scope', '$http', 'EnvConfigurationService', function($scope, $http, EnvConfigurationService) {
var uri = EnvConfigurationService.getMySecretKey();
...
}]);
Still, the returned string is always empty. Any ideas what might be wrong/missing?
Thanks in advance