0

I have configurations.js file which having

var configurationModule = angular.module('configuration', ['restangular', 'notification']);
configurationModule.factory('clientConfigSvc', function (notificationMgr, $interpolate, $injector) {
      function getConfig(configKey) {
        return getNestedPropertiesByString(activeEnvironment, configKey);
      }
}

and having another javascript file with below code

angular.module('ds.coupons').factory('CouponsREST', ['Restangular', 'SiteConfigSvc', 'settings',function (Restangular, siteConfig, settings, configurationModule) {
  configSvc.getConfig('services.baseUrl'); /// need to call this function
}

Actually i want function configSvc.getConfig inside second angular factory

1 Answer 1

0

Yes After tired of trying lots of solution, today morning working on moving train got idea to fix, dont know if its correct way but its working. but still looking for correct fix if mine was not correct as per angularjs practise.

Here is my solution. 1. I added configuration module in app.js alogn with other

window.app = angular.module('ds.app', [
            'restangular',
            'ui.select',
            'ui.router',
            'ds.shared',
            'ds.utils',
            'ds.i18n',
            'configuration']);
  1. I added clientConfigSVC in my factory where i want to use configuration function

    angular.module('ds.coupons') .factory('CouponsREST', ['Restangular', 'SiteConfigSvc','settings', 'clientConfigSvc', function(Restangular, siteConfig, settings, clientConfig) { }

and then inside CouponsREST factory with function clientConfig.getConfig() i am getting value

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.