title: AngularJS "Constant" Factory
body: <p>I'm working on setting up configuration files in AngularJS. Is it possible to create a factory in AngularJS whose key cannot be overwritten? For example, I can set up a constant like this, which cannot be overwritten</p>
  
  <blockquote>
    <p>module.constant('animals', {"cat": "meow", "dog": "woof"});</p>
  </blockquote>
  
  <p>But I'd like to do something like this that allows for overwritten <em>values</em> but not the factory itself</p>
  
  <pre><code>module.value('catSound','meow')
        .value('dogSound','woof')
        .factory('animals', ['catSound','dogSound', function(catSound, dogSound) {
              return {
                   "cat": catSound,
                   "dog": dogSound
              }
        });
  </code></pre>
  
  <p>The above factory can be overwritten allowing for another piece of code to have <code>module.factory('animals',function(){ return 7 })</code> and break everything. However, as a factory, the individual values <em>can</em> (and should) be overwritable, so I should be able to assign <code>module.value('catSound','hiss')</code> and have things still work as expected.</p>
  
  <p>I've tried injecting into constants, but as far as I've been able to understand that isn't possible. How can I prevent my factory declaration from being overwritten? I realize that <em>constant</em> probably isn't the correct term when describing what I want, but I do want the factory's function <em>definition</em> to be constant.</p>