JanStevens / angular-growl-2

growl-like notifications for angularJS projects
MIT License
285 stars 97 forks source link

Support for dev environment #46

Closed rycastaneda closed 9 years ago

rycastaneda commented 9 years ago

can we have a setting for multiple environments such as dev, production etc?

JanStevens commented 9 years ago

So you want to switch global config based on an environment? How would you define your environment in your code? Care to share a example (so I know what your asking for specifically?)

rycastaneda commented 9 years ago

Well I have a constant in my angular module which goes something like this

(function () {
    'use strict';
    angular
        .module('myapp', modules)
        .constant('environment', my_env)
        .config(['growlProvider', '$httpProvider', growler])
})();

I think just on the http interceptor would be fine though.

Well I guess you could just do something like this

(function () {
    angular
        .module('myapp', modules)
        .constant('environment', my_env)
        .config(['growlProvider', '$httpProvider', 'environment', growler])
 function growler (growlProvider, $httpProvider, environment) {
   if (environment === 'dev'){
      $httpProvider.interceptors.push(['$q','growl', '$rootScope', '$interpolate', '$filter', interceptor]);
   }
}
})();

so nevermind. Thanks for the hardwork.