作者:瘦哆哆和胖大雄 | 来源:互联网 | 2023-09-13 22:27
IhavethefollowingmodulecalledEnvConfigurationService,js.erb:我有一个模块叫EnvConfigurationService,js
I have the following module called EnvConfigurationService,js.erb:
我有一个模块叫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:
目的是提供对来自不同角度和常规js类的“MY_SECRET_KEY”的访问。如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
谢谢提前
1 个解决方案